Hello,
i am using NetAdvantage 2012.1 and would like to know if grid editor are supporting DataAnnotation validation.
Thank you
Hardis
Hi,
you are right, I am doing server-side validations. Thanks for your reply, helps me better understand iggrid and igEditors' validation.
Yi
Hi Yi,Yeah, now that I read your question, I should have distinguished that your case doesn't concern MVC DataAnnotation validation :(
Yi Lin said: solved this problem with ajaxComplete and placed a validation summery in front of the grid, though this is not really desirable(ideal solution will be having customized validation rules in ColumnSettings, like required: true, ), it did solve my predicament. thanks!
hi Borislav,
thansk very much for your reply. Sorry that I misunderstood the original question in this post, coz I am not doing MVC DataAnnotation validation,and I just searched your previous reply and found the following...so i thought editorOptions would help me...
3. When using the igGrid's Updating feature, you can use the columnSettings option (http://help.infragistics.com/jQuery/2012.1/ui.iggridupdating#options) to tweak the igEditor used for a specific column. The editorOptions options is the one to take note of.
anyway, your answer is very helpful...I solved this problem with ajaxComplete and placed a validation summery in front of the grid, though this is not really desirable(ideal solution will be having customized validation rules in ColumnSettings, like required: true, ), it did solve my predicament. thanks!
Hi Yi,I'll need to start my answer by re-ordering the sentences of your request in order to provide a proper answer and relation to the previous posts in this thread.
Yi Lin said: I am trying to do a server-side validation when user add/edit row in grid.
OK, although the original poster asked for assistance in configuring the MVC igGrid, my ultimate goal was to help them configure the client-side validation message (thus it although MVC DataAnnotations were used, they weren't taken into consideration in my HTML sample from the previous post).
Yi Lin said: how to setup the editorOptions option?
From what I managed to read and implement so far, the editorOptions option won't be of any use to us in this scenario :(. This is due to the fact that MVC DataAnnotations are meant for HTML forms with server-side defined fields for 1 object - having a different scenario (such as editors of a new/existing row in any sort of grid view), requires a custom (and damn tricky) implementation which ,as far as I was able to understand, cannot be handled by simply using the editorOptions.The reason for this is that when you POST the grid transaction over to the server, the MVC data annotation mechanism cannot kick in - you are not posting a form to which the ASP.NET MVC JavaScripts can hook to and simply display the validation error(s).
Yi Lin said:Can you explain more specific how to integrate custom validation with specific column in iggrid?
Assuming DataAnnotation attributes are indeed used for one or more of the fields of the class which represents 1 row of data in the igGrid, we can still use the MVC DataAnnotations server-side validation logic. Thus, my implementation has the following logic:
Disclaimer: There might be a better way to solve your predicament, but this solution I'm providing is the only one I could piece together.Additional reference (if you're interested):
Yi Lin said:it will be great if you could provide some sample code.
Whenever possible I do try giving a running solution. However, when it comes to something this complicated, you will most often end up with just an advice because providing a working sample means investigating and checking everything stated which can take up a lot of time. Believe it or not, it took me 4 hours to conduct the investigation and to get the sample running properly for this forum thread.Thus, be thankful with what you can get ;).PS: By the way, I believe that the answer to your question is much more suited for a post in our blogs. Since I don't have the permissions to post there, I'll ask my colleagues from the evangelism team if they can spare some time to cook up a post about the predicament and the solution.Cheers,Borislav
hi,
Can you explain more specific how to integrate custom validation with specific column in iggrid? how to setup the editorOptions option? I am trying to do a server-side validation when user add/edit row in grid.
it will be great if you could provide some sample code.
thanks,