I have an asp.net mvc application and I’m using Webgrid to list customers.
I want to edit the customers’ data on the jQuery Dialog, so, I think to do an action on my controller returning a PartialView is the best way. The problem is that this PartialView has some javascript code to validate this input (I’m using jQuery Validation to validate on client side). My questions are:
-
All the script to validate my form on the dialog and send it to server by jquery and ajax, should be on the page or is there any way to put it on the PartialView?
-
How is the best way to load the partialView on my Dialog ($.post, $.get, .load method, etc)? Is mor safe to use by post?
-
Is there any sample of code to post or any link to show-me? I would like to see some samples of code 🙂
Thank you
This SO answer should help you with loading the jQuery UI Dialog with your PartialView, and my experience has been that a PartialView can contain JavaScript, but only if it’s served as if it’s a View, i.e. JavaScript within a PartialView that’s called from another PartialView my not work