Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Hi Everybody,

I have a model Student. That have some properties like Name,Father's Name,Id. Id is rendom generated.

Student stuobj =new Student {id=="707"};
and I have applied the required field validator into Name and Father's Name.

Class Student 
{

public string ID {get;set;}

[Required(ErrorMessage="Please enter the Name of Student ")]   // I need to add paremeter id here with message
public string Name {get;set;}

}


@Html.TextboxFor(m=>m.Name)
@Html.validationMessageFor(m=>m.Name)

but i want the error message like :
"Please enter the Name of Student " + Mode.ID



So pls provide me the solution how can i pass the parameter of id to required field validator.


Thanks
Posted
Updated 8-Sep-13 23:30pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900