views:

150

answers:

2

Hi, 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

+2  A: 

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.

Canavar
i did that but it also displays * in the validation summary along with the error message of the validation summary
pankaj
i only need error message in validation summmary(no *) and only * in required field validator.
pankaj
A: 

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

HotTester