How have you guys been handling writing ASP.NET code (specifically 2.0) for cross browser compatibility?
I know there were all sorts of issues with .NET 1.1 and its default grid layout which MS has reverted back to default flow layout for 2.0.
Do .NET 2.0 controls still render HTML 3.2 to non IE browsers?
I have a bit of webconfig magic I found around the web a while back for forcing HTML 4.0 out regardless of IE or FireFox, which I used to ease the pain a bit in 1 or 2 of the ASP.NET 1.1 apps I have written, but I find this rather odd, as I would think you should not have to do this...
In any event, how have you guys been making out writing web applications to work on multiple browsers?
It would seem that ASP.NET really only cares about you using IE, and makes it rather frustrating to get things looking the same in each browser. (which is why I prefer windows programming over web programming )
Do you use the browsercaps functionality to force ASP.NET to render controls in HTML 4? or do you just let IE see it as a downlevel browser and give HTML 3.2 code?
Don't use browsercaps, just as is.
Although I've used a great deal of CSS so that might explain why it's better in Fx as I understand Fx is more CSS compliant?
It's just little things anyway like text centering and such, nothing too drastic.
Might sound crude, but the problem is probably you. I've been working with 1.1 and 2.0 for quite some time now, and even with UI-complex applications, no problems. It's probably about the technique you're using to render them.
For example, in the case above I'd use a <table> or a <div> bunch to set them in their places. Why did you even use a <span>?
mend, I don't use a span.. when I use VS to layout the webform, it creates spans automatically for much of the formatting, specifically text that I have.
For example.. I type some text, then make it bold, VS makes it a span...
I don't take offense to what you are saying, I know you mean that its all about coding it right in the first place, which is what I am after, however it seems near impossible to use the WYSIWYG editor in VS without it generating HTML that firefox will barf on...
A lot of it yes but I have yet to come across it using Spans, it mostily uses divs
Perhaps there is a setting in VS that you have changed which is using Spans instead?
What I did, and what I recommend, is that you make every effort to prevent any stylistic HTML code from being produced, and that what is produced is valid standards compliant. The built in controls (that I used, anyway) have options for this.
Then, style the whole thing using CSS.
Everything I have done in ASP.NET, with the exception of some Javascript in a third party control, has looked very similar in both browsers.
And yes, I do all the coding in HTML view. Don't touch the WSIWYG editor, it was designed for one purpose only and that is to output code that will render correctly in Internet Explorer 6. Hell, sometimes it even looks bad in IE 7.
The WYSIWYG editor was made for n00bs. No, really.
VS 2005 has a great HTML intellisense, you can use that and things will be better than they were before. It even does XHTML validation and tells you where you're doing something bad.
How have you guys been handling writing ASP.NET code (specifically 2.0) for cross browser compatibility?
I know there were all sorts of issues with .NET 1.1 and its default grid layout which MS has reverted back to default flow layout for 2.0.
Do .NET 2.0 controls still render HTML 3.2 to non IE browsers?
I have a bit of webconfig magic I found around the web a while back for forcing HTML 4.0 out regardless of IE or FireFox, which I used to ease the pain a bit in 1 or 2 of the ASP.NET 1.1 apps I have written, but I find this rather odd, as I would think you should not have to do this...
In any event, how have you guys been making out writing web applications to work on multiple browsers?
It would seem that ASP.NET really only cares about you using IE, and makes it rather frustrating to get things looking the same in each browser. (which is why I prefer windows programming over web programming )
.NET works better in Fx than it does in IE... reason? Standards-compliance. IE violates so many standards it hurts. Yes, cool stuff can be done in IE that can't be done in any other browser, but is it worth violating the law of the land for? I use tables, spans, and spacer images religiously, and all of my pages work identically across all browsers. I don't specify width tags for table cells, spans, OR divs. I create an extra row and column filled with transparent 1x1px .gif images stretched to the right size. No browser can read that wrong.
Thus far, it's the only method I've found that's guaranteed to work cross-browser.
I read this thread is resolved but here's my 2 cents worth.
XHTML & CSS - "the first real html standard" - is able to render properly in all 6+ browsers and most 5+ with some fixes. If you view most web logs or stats you'll see 90 - 99% of all browsers these days are 6+
The morel - SET the validation in VS to XHTML 1.0 or higher and write HTML in source view.
"asp.net 2.0/vb 2005"
ive tried the w3c markup validation service and the error says
there is no attribute "valign". - 8750" alt="Expand Department" valign="middle" /></td>
how can i correct this error, i think my menu control bar is the problem. I've tried to look for the source code but i don't see any code same as the error says.
Some of the ASP.NET controls tend to output 'non-standard' HTML in the sense that it won't validate. For your valign, you'd use CSS instead. If it's an ASP.NET control that you're referring to (menu control bar) then have a look at CSS Adapters in ASP.NET, which allow you to control the way that the control is rendered.
"asp.net 2.0/vb 2005"
ive tried the w3c markup validation service and the error says
there is no attribute "valign". - 8750" alt="Expand Department" valign="middle" /></td>
how can i correct this error, i think my menu control bar is the problem. I've tried to look for the source code but i don't see any code same as the error says.
for the rest of the thread. I find the VS WYSIWYG editor to be useless. and i dont mean to start visual studio bashing at all, but myself personally only use visual studio for the .NET intellisense. 80% of the features that arent in other, more light-weight editors (such as ultra-edit) go unused by me.
I write all my own HTML, and style it accordingly. Just my way of doing it.