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 01:10 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, 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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360