C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to delete the text in the controls after error found in the compare validator?


Posted Date: 04 Jul 2008      Total Responses: 2

Posted By: Hari       Member Level: Silver     Points: 1



Hi,

How to delete the text in the textboxes when an error occurs, i want to delete the text in controls('control to compare' and 'control to validate').
any sample code plz....





Responses

Author: Siddesh Kapadi    04 Jul 2008Member Level: SilverRating:     Points: 2

This is possible using a custom javascript.
As the validation are done using the javascript.
So server side transfer is not possible.



Author: arun kumar    04 Jul 2008Member Level: SilverRating:     Points: 6

<head runat="server">
<script language="javascript" type="text/javascript">
function Check()
{
if (document.form1.Textbox1.value!=document.form1.Textbox2.value)
{
document.form1.Textbox1.value="";
document.form1.Textbox2.value="";
return false;
}
}
</script>
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:textbox ID="Textbox1" runat="server"></asp:textbox>
<asp:textbox ID="Textbox2" runat="server"></asp:textbox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return Check()" />
<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="CompareValidator" ControlToCompare="Textbox1" ControlToValidate="Textbox2" OnLoad="CompareValidator1_Load"></asp:CompareValidator>
</div>
</form>
</body>



Post Reply
You must Sign In to post a response.
Next : How to delete the text in the controls after error found in the compare validator?
Previous : Ajax problem
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use