Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 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.
Stompy is offline  
Old 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.
f00sion is offline  
Old 05-24-2004, 05:12 AM   #3 (permalink)
Crazy
 
What f00sion said, depending on the functionality you need you can also use a DataList or DataRepeater web control instead of a DataGrid. The DataRepeater control is a templeted control, which means you can specify the header, row, and footer HTML yourself.
twister002 is offline  
Old 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.
Stompy is offline  
Old 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.
magua is offline  
Old 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. :
twister002 is offline  
Old 05-24-2004, 07:46 PM   #7 (permalink)
Banned from being Banned
 
Location: Donkey
Quote:
Originally posted by magua
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.
Yep, did all that. Still no cigar.

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..
Stompy is offline  
 

Tags
aspnet or css, attributes, generated, override, style, tables


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 06:27 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54