Control the position of a CustomValidator

  • Thread starter Thread starter Mr. X.
  • Start date Start date
M

Mr. X.

Hello.

How can I control the position of customValidator.

I have code like this (ASP.NET)
<asp:CustomValidator dir = "rtl" CHARSET=WINDOWS-1255"
id = "email_err"
ControlToValidate="a_email"
OnServerValidate="checkEmail"
Text="..."
ErrorMessage="..."
runat="server" />

in CSS I have declared :

#email_err
{
position: absolute;
top:290px;
left:230px;
width:220px;
visibility:visible;
font-size:16pt;
font-weight:bold;
color:red;
}

But, I see that the customValidator's position is not at the position of
CSS.

I want a sample for that, please.

Thanks :)
 
Hello.

How can I control the position of customValidator.

I have code like this (ASP.NET)
<asp:CustomValidator dir = "rtl" CHARSET=WINDOWS-1255"
  id = "email_err"
  ControlToValidate="a_email"
  OnServerValidate="checkEmail"
  Text="..."
  ErrorMessage="..."
runat="server" />

in CSS I have declared :

#email_err
{
  position: absolute;
  top:290px;
  left:230px;
  width:220px;
  visibility:visible;
  font-size:16pt;
  font-weight:bold;
  color:red;

}

But, I see that the customValidator's position is not at the position of
CSS.

I want a sample for that, please.

Thanks :)

The client id of the custom validator is most likely not "email_err".
The ids of server controls are determined not only by their id, but by
all of their parent's ids. "View Source" on your page to see the
actual id. However, a better solution is to just use a css class
instead of id. Try this:

I have code like this (ASP.NET)
<asp:CustomValidator dir = "rtl" CHARSET=WINDOWS-1255"
id = "email_err"
ControlToValidate="a_email"
OnServerValidate="checkEmail"
Text="..."
ErrorMessage="..."
CssClass="email_err"
runat="server" />

in CSS I have declared :

..email_err
{
position: absolute;
top:290px;
left:230px;
width:220px;
visibility:visible;
font-size:16pt;
font-weight:bold;
color:red;

}
 
Back
Top