P
Pai
I have a radio button server side control and a text box server side
control and an a Custom validator control placed on a .apsx page.
I have set the ControlToValidate Property of the Custom Validator
Control to the textbox and set the OnServerValidate method of the
Custom validator to CheckOtherDisease function as below:
<asp:CustomValidator id="CustomValidator2" style="Z-INDEX: 141; LEFT:
544px; POSITION: absolute; TOP: 488px" runat="server" Width="274px"
ControlToValidate="textOtherDisease" ErrorMessage="Enter Valid
Disease"
OnServerValidate="CheckOtherDisease"></asp:CustomValidator>
now when I select the radio button and no text is entered in the
textbox I need a error message to be prompted for the user as
mentioned in the CustomValidator Control
following is the code for the function CheckOtherDisease
public void CheckOtherDisease(object sender, ServerValidateEventArgs
args)
{
string my_disease_default = "";
if (rbnOtherDisease.Checked )
{
if (textOtherDisease.Text.CompareTo(my_disease_default) ==
0)
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}
}
The same doesn't work...
Any help or suggestion would be appreciated.
Kind Regards,
Srikanth Pai.
control and an a Custom validator control placed on a .apsx page.
I have set the ControlToValidate Property of the Custom Validator
Control to the textbox and set the OnServerValidate method of the
Custom validator to CheckOtherDisease function as below:
<asp:CustomValidator id="CustomValidator2" style="Z-INDEX: 141; LEFT:
544px; POSITION: absolute; TOP: 488px" runat="server" Width="274px"
ControlToValidate="textOtherDisease" ErrorMessage="Enter Valid
Disease"
OnServerValidate="CheckOtherDisease"></asp:CustomValidator>
now when I select the radio button and no text is entered in the
textbox I need a error message to be prompted for the user as
mentioned in the CustomValidator Control
following is the code for the function CheckOtherDisease
public void CheckOtherDisease(object sender, ServerValidateEventArgs
args)
{
string my_disease_default = "";
if (rbnOtherDisease.Checked )
{
if (textOtherDisease.Text.CompareTo(my_disease_default) ==
0)
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = true;
}
}
The same doesn't work...
Any help or suggestion would be appreciated.
Kind Regards,
Srikanth Pai.