05-22-2004, 01:38 PM | #1 (permalink) |
Banned from being Banned
Location: Donkey
|
[asp.net/CSS] Override generated tables' style attributes?
If you slap a DataGrid on an asp.net page and leave the settings as default, it generates the table code with along with the following attributes:
cellspacing=0 border=1 rules="all" style="border-collapse:collapse;" ...and that sucks because hard coded HTML overrides any CSS you may have for that particular element. Any style I apply to it regarding border and border-spacing is just flat out ignored. My questions are: 1. Is there a way to prevent asp.net from tossing whatever garbage it wants into the table tags? I just want a pure clean tag with the corresponding id/class: <table id="myDataGrid" class="MainReport"> If not... 2. Is there a way to make sure that CSS overrides all?
__________________
I love lamp. |
05-22-2004, 09:34 PM | #2 (permalink) |
Tilted
Location: So. Cali
|
from my experience, asp.net has a lot of oddities when it comes to the rendered output... sometimes the output is far from w3c compliant, even with made up attributes or improperly named controls... the only way I can think to fix this is to create a new datagrid class which inherits from the datagrid and overrides the render method. i have no idea how to do this though, and i imagine it would be kind of complex.
__________________
Tell me what we’re fighting for— I don’t remember anymore, only temporary reprieve. And the world might cease if we fail to tame the beast; from the faith that you release comes an atheist peace. |
05-24-2004, 07:50 AM | #4 (permalink) |
Banned from being Banned
Location: Donkey
|
Thanks, I'll try either creating a custom data grid or a new repeater.
Man, I've just aboud had it with this designer. It's just utter crap. I have all this perfectly formatted HTMLand the second I switch from design mode to HTML mode, the designer takes it upon itself to reformat and make everything as unreadble as humanly possible. It removes all the tabs/returns i have in place. I neatly indent everything so it makes it easier for me to update later and this designer just totally ruins that. I've even disabled the auto-formatting in the options when saving/switching view mode. Is there anyway to TRULY prevent it from doing this? I mean, if I delselect "auto-format when...", that means I don't want it.. so why is it still doing it? I really wish they'd test their stuff more before sending it off. It's so irritating working with such a buggy designer.. and there's nothing I can do about it.
__________________
I love lamp. |
05-24-2004, 05:49 PM | #5 (permalink) |
Tilted
|
Tools->Options->Text Editor->HTML/XML->Format
Uncheck both 'Apply Automatic Formatting' options. (edit: Oops. I see this is what you already referred to. Well, then, the designer shouldn't actually do anything. Unless, god forbid, you use it to add a control or move stuff around. In that case, I don't think there's anything you can do. I get around this by not using the designer.) Also, under Tools->Options->HTML Designer->General, you can choose to default to the HTML, not Designer, view. |
05-24-2004, 07:29 PM | #6 (permalink) |
Crazy
|
Look here http://blogs.msdn.com/mikhailarkhipo...16/132886.aspx
for an explanation of the HTML mangling. FYIW, this is fixed in the next version (Whidbey) due out sometime in 2005 last I heard. This is fixed in the beta version I've got so I have faith that they won't do anything between now and release to screw it up. : |
05-24-2004, 07:46 PM | #7 (permalink) | |
Banned from being Banned
Location: Donkey
|
Quote:
It's funny, because I have this series of list items (the ul/li tags), and with each item, I put it between the <li> and </li> tags... but when formatting takes over, it REMOVES the closing li tag and then later proceeds to complain that a tag is missing
__________________
I love lamp. Last edited by Stompy; 05-24-2004 at 07:49 PM.. |
|
Tags |
aspnet or css, attributes, generated, override, style, tables |
|
|