J
Jeff
hey
net 3.5
I have problem with a customvalidator. I enter values into the TextBox named
"txt" and clicks on the save button (ibSave) then the TestValidate method
get triggered. TestValidate set args.IsValid = false and the customvalidator
displays an error on the webpage. The problem is that when I check in the
database, the value has still been added to the database. if the value
entered in the TextBox is not a correct value, then I want it not store it
in the database...
below are my markup and code-behind
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
<asp:CustomValidator ID="valCustom" ControlToValidate="txt"
OnServerValidate="TestValidate" Display="Dynamic" runat="server"
ErrorMessage="CustomValidator"></asp:CustomValidator>
<asp:ImageButton ID="ibSave" ImageUrl="~/Images/Go.gif"
OnClick="ibSave_method" runat="server" />
protected void TestValidate(object source, ServerValidateEventArgs args)
{
// do some processing/
args.IsValid = false;
}
any suggestions?
net 3.5
I have problem with a customvalidator. I enter values into the TextBox named
"txt" and clicks on the save button (ibSave) then the TestValidate method
get triggered. TestValidate set args.IsValid = false and the customvalidator
displays an error on the webpage. The problem is that when I check in the
database, the value has still been added to the database. if the value
entered in the TextBox is not a correct value, then I want it not store it
in the database...
below are my markup and code-behind
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
<asp:CustomValidator ID="valCustom" ControlToValidate="txt"
OnServerValidate="TestValidate" Display="Dynamic" runat="server"
ErrorMessage="CustomValidator"></asp:CustomValidator>
<asp:ImageButton ID="ibSave" ImageUrl="~/Images/Go.gif"
OnClick="ibSave_method" runat="server" />
protected void TestValidate(object source, ServerValidateEventArgs args)
{
// do some processing/
args.IsValid = false;
}
any suggestions?