Validator controls automatically trigger validation checks for every postbackirrespective of whether you need validation or not. To prevent this, set
CausesValidation="False" for the control for which you do not need validation. The code below will help illustrate:
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Label id="Label1" runat="server">Name</asp:Label>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Save"></asp:Button>
<asp:Button id="Button2" runat="server" Text="SomeOtherInfo"
CausesValidation="False"></asp:Button>
<asp:RequiredFieldValidator id="RequiredFieldValidator1"
runat="server" ErrorMessage="User Name is required"
ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:Label id="Label2" runat="server">Label</asp:Label>
</form>
</body>
</HTML>
If you simply drop two buttons on the form, clicking either button triggers validation by default. But because you don't need a validation check when you hit
Button2, setting
CausesValidation="False" in the
Button2 control will do the trick.