1

I am doing validations in registration page.My requirement is if ValidationSummary error message is generated i,e,ValidationSummary is become true then i have to display that ValidationSummary message in that div element.If error is not generated then that div element is not visible.

So i have to check whether Validationummary is true then div element is diplayed otherwise it will be hidden.So please tell me how to do this .

Initially i made the div Display:none.Now i have to make it display:visible when error generated.we can do this using javascript or what?

1 Answer 1

2

You could use the IsValid property of the model state.

<% if (!ViewData.ModelState.IsValid) { %>

<% } %>
Sign up to request clarification or add additional context in comments.

5 Comments

wow,thanks darin.It works perfectly.one more issue is there.I am using a UserRegistration page.if i submit that page it will go to userregistration post action.i want to send one eventid along with the form values to the post action method.is it possible to send like that.
When you generate the form using Html.BeginForm you can specify to which controller and action submit the form. You can also use additional route values parameter allowing you to pass the eventid.
i have done what you said in html.beginform().Please tell me about additional route values.Because if i send the eventid to congtroller action ,from that i need to send to other view.
Here's the BeginForm overload allowing you to send additional route values as an anonymous object.
@DarinDimitrov Does it wor with ClientSide Validation too?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.