Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to display only single message for multiple RequiredFieldValidators?

how to display only single message for multiple RequiredFieldValidator instead of individual message for RequiredFieldValidator ?

i want to as shown in following image..

i want to as shown in following image..

my view is..

 my view is.

like image 602
Rohan Avatar asked Jan 12 '12 12:01

Rohan


3 Answers

You will have to use ValidationSummary control for this. See this ValidationSummary Class MSDN article for details and example on how to do this. This article contains an example of what you are trying to figure out exactly.

like image 183
Maheep Avatar answered Oct 02 '22 00:10

Maheep


set the HeaderText to something like "(*) Fields are required" to your validation summary.

like image 37
Neha Avatar answered Oct 01 '22 23:10

Neha


you can leave error message field of each RequiredFieldValidator blank and put * in text field, then add ValidationSummary defining its header text with error msg this will works for your scenario.

<asp:RequiredFieldValidator ID="RequiredFieldValidator_overhead_name" runat="server" ControlToValidate="TextBox_overhead_name">*</asp:RequiredFieldValidator>


 <asp:ValidationSummary ID="ValidationSummary_overhead_estimate" runat="server" DisplayMode="SingleParagraph" HeaderText="please insert data into fileds" /> 
like image 26
Dipen Avatar answered Oct 02 '22 00:10

Dipen