0

i use mvc3 razor in my form i use this code:

@Html.ValidationMessage(Model.SMF_Name)

it's not working because it render

<span class="field-validation-error" data-valmsg-for="About" data-valmsg-replace="true">
<span htmlfor="About" generated="true" class="">Please fill this field.</span>
</span>

it's put the value instead of the name in the htmlfor attribute.

1 Answer 1

1

Did you try:

@Html.ValidationMessageFor(x => x.SMF_Name)
Sign up to request clarification or add additional context in comments.

3 Comments

yes i get error - Cannot convert lambda expression to type 'string' because it is not a delegate type - i tried even m => Mode.SMF_Name
@eyalb, is SMF_Name a property on your model?
In this case @Html.ValidationMessageFor(x => x.SMF_Name) should work.

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.