xVal with DataTables

Oct 29, 2009 at 2:24 PM

Hey There,

I have server side validation running for my data-tables quite nicely. I simply Return rules errors from my business logic with no prefix and the column name from the datatable (since the name of the input control is taken from the column name in the data-table).  However I'm struggling to set this up on the client side, I thought I might be able to simple use the HtmlHelper.ClientSideValidation(prefix,RuleSet) method setting the prefix to null or string.Empty (tried both) and putting the id/name as the string key of each rule and the required rule object  as the value. 

This does output something into the page ...

<script type="text/javascript">xVal.AttachValidator("", {"Fields":[{"FieldName":"CODE","FieldRules":[{"RuleName":"Required","RuleParameters":{},"Message":"Required"}]}]}, {})</script>

and I have an input with id and name both "CODE".

Am I doing something horribly wrong.