CSS, HTML, ASP.NET - performance??

  • Thread starter Thread starter Ivan Demkovitch
  • Start date Start date
I

Ivan Demkovitch

Hi!

I wonder if I get any performance hit when I do following with some of my
user controls:

I don't have HTML section, but instead, I use code like;
this.Controls.Add(new LiteralControl("<div id=\"MdlHd\">" + article.Title +
"</div>"));

to populate HTML.

This gives me flexibility for using CSS and I can target different browsers.
I also save a lot of network traffic.

Am I doing right thing or it is a bad practice?
 
Hi Ivan,

I've been stuggling with the same thing. Apparently you want to use the ID
of the Control for your CSS. Because ASP.Net renames client-side IDs, you
want to preserve the ID. However, this makes maintaining the app much more
difficult, effectively eliminating the advantage of using a Template. I'm
thinking more along the lines of using CSS classes, which don't get renamed.
I think it would be great if MS came up with a "Dynamic StyleSheet" which
would translate the IDs per page.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Hmm... you are essentially creating an Object, when all you want to do is
add text to your html output. This is bad.
Creating objects is expensive, though you may find the flexibility you're
getting from it very worth it. If you only have 10 users to this site, and
it can keep up, why not? If you want scalability, you are heading in the
wrong direction.
 
Thanks everyone for replys!

I understand issues with handling events and ID's

But I think I head in right direction. I don't use this approach for
everything.
But some "blocks" - or user controls in my page don't need flexibility.
Those are that display only and don't need user
interaction, but do need dynamic content.

Some times it's just a text or a hyperlinks. And I found it to be a big
savings to not have Labels
because of this <span> tags.
Especially for DataLists, even not making it table, it will include <Span>
for each item.

As far as CSS - I think it works ok for me. Instead of panels I use <DIV>
with runat =server and their ID's fine.
I use it for main page layout..
 
Looks good...

--
CharlieN
VSU

This posting is provided "AS IS" with no warranties, and confers no rights.

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
--------------------
 
Back
Top