DCSIMG
Login Control in IE8 - A Bit Lighter

A Bit Lighter

Simple things that may help you

Login Control in IE8

If you have an ASP.NET Logon control on your page, likely you have noticed that IE8 renders it in a distorted way:

image

I guess the reason is because the input controls used for the User Name and Password are styled as width:20ex and IE8 treats ex-based width differently for inputs of type “text” and “password”.

There is a simple work-around fixing the problem.

Handle the OnInit event  of the Login control like this:

protected void Login1_Init(object sender, EventArgs e)
{
    System.Web.UI.WebControls.Login login = sender as System.Web.UI.WebControls.Login;
    TextBox txtUserName = login.FindControl("UserName") as TextBox;
    TextBox txtPassword = login.FindControl("Password") as TextBox;
    txtUserName.CssClass = "FixedLogin";
    txtPassword.CssClass = "FixedLogin";
}

and the CSS will be:

.FixedLogin
{
    margin-top:1ex;
    margin-left:1ex;
    width:150px!important;
}

 

Enjoy the result:

image

Posted: Jan 20 2010, 10:56 AM by egoldin | with 2 comment(s)
תגים:, ,

Comments

Eugene said:

Thank you! Funny how their component wasn't tested to work with their web browser.

# June 29, 2010 11:28 PM

Cosmin said:

Yes. Thank you.

# May 5, 2011 1:52 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: