jqModal and ASP.NET MVC -


I want to make an easy way to add new products using jqModal

See / home / index.aspx:

  & lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('# addProductControlSection'). Jqm ({modal: true, Ajax: '& lt;%: Url.Action ("AddProduct", "Home")% & gt; ', OnHide: myAddClose}; function myAddClose (hash) {hash.Weighted (' 1000 ', function) (hash.O.remove);});}}); & Lt; / Script & gt; // Rest of code ... & lt; A href = "#" class = "jqmodal" & gt; Add Products & lt; / A & gt; & Lt; Div id = "addProductControlSection" class = "jqmWindow" & gt; & Lt; / Div & gt;  

Home Controller:

  Public Functionality AddProduct () {Return View (); } [AcceptVerbs (HttpVerbs.Post)] Public Functional AddProduct (Product Products) {if (ModelState.IsValid) {// How to show an error? } _productRepository.Save (product); // How can I show 'success' or something ...}  

I do not know how to apply verification if user product I enter the wrong value for the price and click the save button, so I do not want to close the form.

Thank you!

To generate JS automatically or Take a look at the fact that it is in a modern dialogue, there should be no effect on these techniques.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -