I was working on migrating MVC1 app to MVC2 today and i have come across a problem while changing the ValidationMessage to ValidationMessageFor implementation.
The below code works fine and i can see the validation message came from
modelstate.
<%= Html.ValidationMessageFor(model => model.SecurityQuestions[0].Question)%>
Is this somewhat a bug in "ValidationMessageFor" or am i missing something here?
Sorry I dont get the point. In my view i have to display first two indexes of SecurityQuestions generic list and the validation messages for them. Can you give me an example.
kotuadam
Member
146 Points
34 Posts
ASP.NET MVC - ValidationMessageFor
Apr 08, 2010 01:07 PM|LINK
Hi,
I was working on migrating MVC1 app to MVC2 today and i have come across a problem while changing the ValidationMessage to ValidationMessageFor implementation.
Is this somewhat a bug in "ValidationMessageFor" or am i missing something here?
Thanks.
ricka6
All-Star
15070 Points
2272 Posts
Microsoft
Moderator
Re: ASP.NET MVC - ValidationMessageFor
Apr 08, 2010 05:40 PM|LINK
Try this with a simplified model (no array) model.SecurityQuestions.Question
kotuadam
Member
146 Points
34 Posts
Re: ASP.NET MVC - ValidationMessageFor
Apr 09, 2010 08:00 AM|LINK
I cant use it as you mentioned. It is a generic list.
public List<SecurityQuestion> SecurityQuestions { get; set; }ricka6
All-Star
15070 Points
2272 Posts
Microsoft
Moderator
Re: ASP.NET MVC - ValidationMessageFor
Apr 09, 2010 10:07 PM|LINK
so try it with a simple string property accessor
kotuadam
Member
146 Points
34 Posts
Re: ASP.NET MVC - ValidationMessageFor
Apr 12, 2010 12:08 PM|LINK
Sorry I dont get the point. In my view i have to display first two indexes of SecurityQuestions generic list and the validation messages for them. Can you give me an example.
kotuadam
Member
146 Points
34 Posts
Re: ASP.NET MVC - ValidationMessageFor
Apr 21, 2010 07:33 AM|LINK
I am still stuck with this issue and i think that this can be a bug in MVC 2.
Any ideas?
bradwils
Contributor
5779 Points
691 Posts
Microsoft
Re: ASP.NET MVC - ValidationMessageFor
Apr 21, 2010 07:34 PM|LINK
Looks like a bug.