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:CustomVali dator ID="valCustom" ControlToValida te="txt"
OnServerValidat e="TestValidate " Display="Dynami c" runat="server"
ErrorMessage="C ustomValidator" ></asp:CustomValid ator>
<asp:ImageButto n ID="ibSave" ImageUrl="~/Images/Go.gif"
OnClick="ibSave _method" runat="server" />
protected void TestValidate(ob ject source, ServerValidateE ventArgs 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:CustomVali dator ID="valCustom" ControlToValida te="txt"
OnServerValidat e="TestValidate " Display="Dynami c" runat="server"
ErrorMessage="C ustomValidator" ></asp:CustomValid ator>
<asp:ImageButto n ID="ibSave" ImageUrl="~/Images/Go.gif"
OnClick="ibSave _method" runat="server" />
protected void TestValidate(ob ject source, ServerValidateE ventArgs args)
{
// do some processing/
args.IsValid = false;
}
any suggestions?
Comment