Hi
One thing to look at your page is, there is no CausesValidation="true" for the image button.
Here is an example
On the aspx page
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:ScriptManager ID="script1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" Visible="true">
<ContentTemplate>
<asp:Label runat="server" Text="This is a required field" ></asp:Label>
<asp:TextBox ID="text1" runat="server" ></asp:TextBox>
<asp:Label ID="validation_result" runat="server" ></asp:Label>
<asp:CustomValidator ID="CustomValidator1" runat="server"
ControlToValidate="text1" OnServerValidate ="validateTextBox"></asp:CustomValidator>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server"
ControlToValidate="Text1"
ErrorMessage="Password Should Not Be Empty"
Display="Dynamic">
</asp:RequiredFieldValidator>
<asp:ImageButton ID="imgRegister" runat="server"
Font-Bold="True" ImageUrl="~/App_Data/arrow.png"
OnClick="imgRegister_Click" CausesValidation="true"/>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
In the code behind...
protected void imgRegister_Click(object sender, ImageClickEventArgs e)
{
if (Page.IsValid == true)
{
this.validation_result.Text = "Validated";
}
else
{
this.validation_result.Text = "Password should be 8 or more in characters";
}
}
protected void validateTextBox(object sender, ServerValidateEventArgs e)
{
if (Convert.ToString(e.Value).Length > 7)
{
e.IsValid = true;
}
else
{
e.IsValid = false;
}
}