asp.net and Firefox

  • Thread starter Alejandro Penate-Diaz
  • 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
 
A

Alejandro Penate-Diaz

to be more specific overflow:auto property of <div> doesn' work, as well as
some <td> and <tr> widths and heights.
 
G

Guest

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);
}

}
 
A

Alejandro Penate-Diaz

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.
 
G

Guest

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top