How to do server validation in bootstrap pop-up modal?


I am using partial in pop-up modal, and I wanted to do a server validation but I want the modal will stay, is it possible without reloading?

I am using "Ajax.BeginForm". Thanks


Asked by:- Aileereal
1
: 464 At:- 7/28/2017 3:38:55 PM
ASP.NET MVC C# POPUP MODAL BOOTSTRAP






2 Answers
profileImage Answered by:- manish

You can validate your modal pop in MVC, and can stay it open, using jquery Unobtrusive Validation, you can read about this in a similar issue here

https://forums.asp.net/t/1977530.aspx?Unobtrusive+Validation+Within+Modal+PopUp

Or you can use this client side validation using jquery ajax to validate your form before submitting

Hope this helps, please upvote/comment on this answer, if this work or if you find any issue with this answer

1
At:- 7/28/2017 3:51:38 PM Updated at:- 7/28/2017 3:58:51 PM
@manish Thanks, regarding to this issue is solved. But how about after success insertion of data, i also wanted to stay the modal and clear out the text in textfield? Instead redirecting to the Index View? 0
By : Aileereal - at :- 7/29/2017 10:39:51 AM
reload the partial View to clear out the field, using "OnSuccess" of Ajax.BeginForm, your view shouldn't be redirected if you are applying as told in above answer 0
By : vikas_jk - at :- 7/29/2017 4:05:27 PM
can you give me links or sample code? because in create controller you cant leave out a return, how i can bypass this return method. Thanks. 0
By : Aileereal - at :- 7/29/2017 5:22:15 PM
not able to understand your requirements, please create a new question with your complete code in it, and your error details with the image, explain the issue with text in image. You would have to do some work to properly ask your query. Meanwhile, here is another link, which may be helpful, it shows all the details step by step http://www.dotnetqueries.com/Article/56/show-validation-messages-in-bootstrap-modal-popup 0
By : vikas_jk - at :- 7/30/2017 7:37:28 AM


profileImage Answered by:- vikas_jk

Here the another solution for you with tested example

Refer the linked article, which will help you to keep bootstrap pop-up modal opened even after saving the details correctly.

0
At:- 7/30/2017 12:52:48 PM





Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use