asp.net and Firefox

  • Thread starter Thread starter Alejandro Penate-Diaz
  • Start date Start date
A

Alejandro Penate-Diaz

Hi. Recently I discovered that my asp.net site doesn't render ok in Firefox,
so I added some browser caps into my web.config file as adviced in some
articles, but nothing happened. Please need some advice on that.
Thanks,
Alejandro
 
to be more specific overflow:auto property of <div> doesn' work, as well as
some <td> and <tr> widths and heights.
 
I also had trouble with the TextBox widths in Firefox, Netscape, and Safari
browsers. I worked around it by deriving a class from TextBox and overriding
the Render method. You could probably do the same to solve your issue with
the controls. Here's the code I used for my fixed textbox:

public class FixedTextBox : System.Web.UI.WebControls.TextBox
{
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
#region Add Cross Browser Size To Attributes Collection
#region Width
if(this.Width != System.Web.UI.WebControls.Unit.Empty)
{
string WidthString = this.Width.Value.ToString();
#region Append UnitType Symbol
switch(this.Width.Type)
{
case System.Web.UI.WebControls.UnitType.Percentage:
WidthString += "%";
break;

case System.Web.UI.WebControls.UnitType.Pixel:
WidthString += "px";
break;
}
#endregion Append UnitType Symbol
if(this.TextMode == System.Web.UI.WebControls.TextBoxMode.MultiLine)
{
this.Attributes.Add("width", WidthString);
this.Attributes.Add("style", "width:" + WidthString); // Firefox
}
else
{
//this.Attributes.Add("width", WidthString);
this.Attributes.Add("style", "width:" + WidthString); // Firefox
}
}
#endregion Width
#region Height
if(this.Height != System.Web.UI.WebControls.Unit.Empty)
{
string HeightString = this.Height.Value.ToString();
#region Append UnitType Symbol
switch(this.Height.Type)
{
case System.Web.UI.WebControls.UnitType.Percentage:
HeightString += "%";
break;

case System.Web.UI.WebControls.UnitType.Pixel:
HeightString += "px";
break;
}
#endregion Append UnitType Symbol
this.Attributes.Add("height", HeightString);
}
#endregion Height
#endregion Add Cross Browser Size To Attributes Collection
base.Render (writer);
}

}
 
thanks a lot. I'll try that to fix widths and heights. still <div>
attributes don't work and it is static html so I don't know how to fix that.
but I think your solution can fix 50% of my problems.
tnx,
Alejandro.
 
Your welcome. Since you have to add a "runat=server" tag to div's to access
them in asp.net anyways, this should work with those too (just derive from
the HtmlGenericControl).
 
Back
Top