J
Jose Fernandez
Hola
I have this customvalidator
<asp:CustomValidator id="ComboValidator" runat="server"
ErrorMessage="CustomValidator" /> (The OnServerValidate method is set in
Events windows of the Control Property)
THIS IS THE METHOD
private void ValidarCombo(object sender, ServerValidateEventArgs e)
{
int counter=0;
foreach(Control control in this.Controls[1].Controls)
{
if(control.GetType().ToString().IndexOf("DropDownList")!=-1)
{
DropDownList combo=(DropDownList)control;
if(combo.SelectedItem.Value=="---")
{
counter++;
}
}
}
e.IsValid=(counter==0);
counter++;
}
It works perfectly. If a DropDownList is not selected, e.Valid is set to
false and also Page.IsValid BUT the page continues as if it was TRUE. Am I
missing something??
Thanks in advance
I have this customvalidator
<asp:CustomValidator id="ComboValidator" runat="server"
ErrorMessage="CustomValidator" /> (The OnServerValidate method is set in
Events windows of the Control Property)
THIS IS THE METHOD
private void ValidarCombo(object sender, ServerValidateEventArgs e)
{
int counter=0;
foreach(Control control in this.Controls[1].Controls)
{
if(control.GetType().ToString().IndexOf("DropDownList")!=-1)
{
DropDownList combo=(DropDownList)control;
if(combo.SelectedItem.Value=="---")
{
counter++;
}
}
}
e.IsValid=(counter==0);
counter++;
}
It works perfectly. If a DropDownList is not selected, e.Valid is set to
false and also Page.IsValid BUT the page continues as if it was TRUE. Am I
missing something??
Thanks in advance