karthik v

karthik v

  • NA
  • 109
  • 70.7k

MVC compare

Apr 12 2012 4:13 PM
hi experts i am trying to compare two validation messages on my view in mvc2 framework.

this is what i am trying to use ....


 <%if( Html.ValidationMessageFor(xx => xx.prefix)!= Html.ValidationMessageFor(xx => xx.Number))
 { %>
 <%= Html.ValidationMessageFor(xx => xx.Number)%>
  <%}%>

The above code need to perform when the two validation messages are same but it does not do so in the above comparison..

The above code works when i convert both the html.validationmessagefor(xx=>xx.prefix).tostring()

But it breaks when the user inputs the expected value because there will not be any validation error..

Any ideas?

Your help is greatly appreciated...