Hi samsmuthu,
You must call Page.IsValid method before the Page.IsValid property to force validation manually.
HTML
<div class="form">
<asp:UpdatePanel ID="UpdatePanelSub" runat="server">
<ContentTemplate>
<asp:TextBox ID="TxtSubscribeEmail" runat="server" placeholder="enter your email" TextMode="Email" CssClass="email"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TxtSubscribeEmail" Display="Dynamic"
ErrorMessage="* Email required." Font-Size="Small"
ForeColor="red" SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TxtSubscribeEmail" Display="Dynamic"
ErrorMessage="* Email address wrong." Font-Size="Small"
ForeColor="red" SetFocusOnError="True"
ValidationExpression=".*@.*\..*"></asp:RegularExpressionValidator>
<span>
<asp:Label ID="LblMessage" runat="server"></asp:Label></span>
<asp:Button ID="BtnSubscribe" runat="server" Text="subscribe" CssClass="btn" OnClick="BtnSubscribe_Click" CausesValidation="false" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
Code
C#
protected void BtnSubscribe_Click(object sender, EventArgs e)
{
Page.Validate();
if (Page.IsValid)
{
}
}
VB.Net
Protected Sub BtnSubscribe_Click(ByVal sender As Object, ByVal e As EventArgs)
Page.Validate()
If Page.IsValid Then
End If
End Sub