I have an input button on my page that is dynamically created, every time I press it, it fires the RequiredFieldValidator for the blank field in the email address. is there a way to ovverride it?
input code:
<input class=\"hledat\" id=\"searchbutton\" type=\"image\" src=\"search-button.gif\" value=\"{0}\" onclick=\"search('{1}');\" onkeypress=\"search('{1}');\"/>"
validator code:
<asp:TextBox runat="server" ID="txtEmail" ClientIDMode="Static" Width="98%" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="txtEmail" ErrorMessage="email"
Display="dynamic" ValidationGroup="newsletter" />
<asp:RegularExpressionValidator runat="server" ControlToValidate="txtEmail" ErrorMessage="email"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="dynamic"
ValidationGroup="newsletter" />
I have an input button on my page that is dynamically created, every time I press it, it fires the RequiredFieldValidator for the blank field in the email address. is there a way to ovverride it?
HtmlButton.CausesValidation Property
<button causesvalidation="false" /><button ID="StateQueryButton"
CausesValidation="False"
runat="server">
Submit
</button>
yes, i want it to do a postback
HtmlButton.OnServerClick Method
protected void FancyBtn_Click(object sender, EventArgs e)
{
}
<button causesvalidation="false" /><button ID="StateQueryButton"
CausesValidation="False"
OnServerClick=" FancyBtn_Click"
runat="server" >
Submit
</button>