Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two textbox controls and added two required fields validation controls and set the text property of the validation control <img> tag. After that added a button control.
When I click the button without filling anything in the textbox it display images which I have putted in the required field validation control. But I want to display bottom of the button control a text description when any of the required validation is not valid.
I think this can be using if(page.isvalid) then display the text description. But it only work when javascript is disable.
I tried validation summary. This validation control display message like this.

First TextBox is required.

Second TextBox is required.

But I just want to display meaning of the image which I have putted in the text property of the validation control like when any of the textBox is empty then an Image icon is displayed near that textBox and text description bottom of the button control: "Required Fields!"
Posted
Comments
AshishChaudha 28-Jul-12 6:41am    
What you have tried so far???

Use this

XML
<asp:TextBox ID="txtFirst" runat="server"></asp:TextBox>

    <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
        runat="server" ErrorMessage="FirstErrorText" ControlToValidate="txtFirst">
        <img src="Error.png" />       
        </asp:RequiredFieldValidator>

 <asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
 
Share this answer
 
v2
You can add a label at the bottom of the page and make it visible when Page.IsValid==false.

For Example:
C#
If(Page.IsValid==true)
{
  lblMsg.visible=false;
  <!--your other stuff-->
}
else
{
  lblMsg.visible=true;
  lblMsg.Text="*/Picture Marked Fields are Required!"
}
 
Share this answer
 
v3
Comments
Dinesh Ambaliya 29-Jul-12 9:19am    
Thank you for your try.
But as mentioned in my question this only work when javascript is disabled in browser.
pradiprenushe 30-Jul-12 4:04am    
Use below answer.

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