posts - 380, comments - 634, trackbacks - 117,
Dan Bartels online engineering logbook... Items that I find useful organized for my use, and indexed by google for yours. Here you can find information about Microsoft C# programming, SQL SERVER 2005, Telligent Systems CommunityServer, Dot Net Nuke, Windows Vista / Longhorn, and just about anything else that would compel me to type.

News

What I am Reading:


Professional Community Server

Past books can be viewed on:

Post Categories

Archives

Coding Techniques

Coding Tools

Community Sites

Deal Finders

Friends Businesses

Microsofties

Smartphones

Utilities

my blogmap
Shortening Control IDs in Hyperlinks

I am a big fan of direct navigation on web pages, and to that end, I find myself using a fair amount of asp:hyperlink controls.  The problem I ran into was that the ASP.NET generated control id's for these controls was becoming a significant portion of the size of my web pages.  So I wrote a helper class, that transforms the auto generated ClientID back into the nice short one you gave the control in the first place (Good for Javascript access and CSS use)

which changes this : <a id="_ctl0__ctl0__ctl0__ctl0__ctl0__ctl0_RightColumnRegion_BlogSideBar1__ctl0_Categorylist1__ctl0_Categories__ctl0_Link" href="http://blog.danbartels.com/APPLE/blogs/sample_weblog/archive/category/1002.aspx">Blogging (2)</a>

into this : <a id="Link" href="http://blog.danbartels.com/APPLE/blogs/sample_weblog/archive/category/1002.aspx">Blogging (2)</a>

To use this, all you have to do is replace your old <asp:hyperlink> tags with your new <DB:href>

Dan

Note: you will need to add a control declaration to your aspx / ascx for this to work....  something like

<%@ Register TagPrefix="DB" Namespace="DanBartels.Controls" Assembly="DanBartels.Controls" %> 

Published Friday, November 11, 2005 11:18 AM by DanB

Filed under , ,
::

Comments

# re: Shortening Control IDs in Hyperlinks @ Friday, November 11, 2005 10:52 PM

By adding and using this control on the home page of my blog, I reduced the HTML size from 78K to 67K, trimming over 10 K of useless control ID's.. Now I still left the basic ID in there, but even that could be removed for a further savings.

Dan

DanB

Leave a Comment

(required) 
(required) 
(optional)
(required) 
 
Powered by Community Server (Commercial Edition), by Telligent Systems
powered by god (with a little help from Telligent Systems - Community Server 2.1)