Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

validation summary problem

i have a page where i am using validation summary and required field validators. When i click the validation button error message is being dispalyed in both validation summary is showing message written in required field validators. I want to display different message in validation summary and required field validators. e.g validation summary should display "field marked with * are mandatory" and required field validator should display only a "*".

Thanks

like image 230
pankaj Avatar asked Dec 29 '22 03:12

pankaj


2 Answers

Set your validator's Text property to "*". This will be displayed at validator's text when validation fails, and the ErrorMessage will be displayed by the validation summary.

like image 197
Canavar Avatar answered Dec 31 '22 16:12

Canavar


Pankaj try this code...

        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
        ErrorMessage="Error" ControlToValidate="TextBox1">*</asp:RequiredFieldValidator>

    <br />
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
        DisplayMode="List" />
</div>
<asp:Button ID="Button1" runat="server" Text="Button" />

Here i have set the DisplayMode property of validation summary to List

like image 34
HotTester Avatar answered Dec 31 '22 16:12

HotTester