469,609 Members | 1,437 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Cross-browser compat. question

Hi everybody,

I was doing some cross-browser tests today and I found out that if you
specify the width and height for a button type control, asp.net doesn't
output the style information when viewing the page with the latest version
of firefox. I copy-pasted the page source to an html file and opened it
with firefox and the styles were applied to the button with no problem. My
question is then this: Is there a way to control what ASP.NET outputs to
the browser or alter in some way its browser detection? It's a good thing
to suppress style information and functionality that browsers don't support,
but it's another when the browser in fact supports it. I suppose that for
microsoft, it basically boils down to "our browser" and "the others", but I
thought I would ask anyway.

Thanks for any help or insight!

Eric.
Nov 18 '05 #1
2 1217
Hi Eric,

Right now there isn't a totally easy way to have it span ASP.Net. However
you can do this manually without a lot of trouble. Basically you can
subclass a control (i.e. Button) and override the Render event so that you
output HTML that will be cross browser compatible. Then for each button you
place in all your applications you have them inherit from the Button that
you created.

Inside the Render event you can test for the browser type but an easier way
is to create an Enum of all the browsers you support. Then in the
contructor of your button set an internal property for the type of browser
detected. If it is one you support or need to do something for use that
enum to determine what to output. If it isn't a browser you have specific
support for you can call the base object Render event or create a real
scaled down plain option that should work with every browser.

Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Eric Caron" <ec****@nospam.quebecaffaires.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi everybody,

I was doing some cross-browser tests today and I found out that if you
specify the width and height for a button type control, asp.net doesn't
output the style information when viewing the page with the latest version
of firefox. I copy-pasted the page source to an html file and opened it
with firefox and the styles were applied to the button with no problem. My question is then this: Is there a way to control what ASP.NET outputs to
the browser or alter in some way its browser detection? It's a good thing
to suppress style information and functionality that browsers don't support, but it's another when the browser in fact supports it. I suppose that for
microsoft, it basically boils down to "our browser" and "the others", but I thought I would ask anyway.

Thanks for any help or insight!

Eric.

Nov 18 '05 #2
force asp.net to behave, try:

private void Page_Load(object sender, System.EventArgs e)
{
if ("netscape|gecko|opera".IndexOf(this.Request.Brows er.Browser.ToLower())
=0 ) this.ClientTarget = "Uplevel";
}

-- bruce (sqlwork.com)

"Eric Caron" <ec****@nospam.quebecaffaires.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... Hi everybody,

I was doing some cross-browser tests today and I found out that if you
specify the width and height for a button type control, asp.net doesn't
output the style information when viewing the page with the latest version
of firefox. I copy-pasted the page source to an html file and opened it
with firefox and the styles were applied to the button with no problem. My question is then this: Is there a way to control what ASP.NET outputs to
the browser or alter in some way its browser detection? It's a good thing
to suppress style information and functionality that browsers don't support, but it's another when the browser in fact supports it. I suppose that for
microsoft, it basically boils down to "our browser" and "the others", but I thought I would ask anyway.

Thanks for any help or insight!

Eric.

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by rollasoc | last post: by
7 posts views Thread by Scott M. | last post: by
6 posts views Thread by ampo | last post: by
reply views Thread by Solution2021 | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.