Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [asp.net/CSS] Override generated tables' style attributes? (https://thetfp.com/tfp/tilted-technology/56499-asp-net-css-override-generated-tables-style-attributes.html)

Stompy 05-22-2004 01:38 PM

[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?

f00sion 05-22-2004 09:34 PM

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.

twister002 05-24-2004 05:12 AM

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.

Stompy 05-24-2004 07:50 AM

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.

magua 05-24-2004 05:49 PM

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.

twister002 05-24-2004 07:29 PM

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. ::rolleyes: :D

Stompy 05-24-2004 07:46 PM

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 :rolleyes:


All times are GMT -8. The time now is 11:11 AM.

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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76