I have auto ID set in asp.Net. My hyperlink's ID is way too big ctl00_Body_grvDocs_ctl45_hypDocNav
How can I reduce the ID's length? I want to keep it auto but atleast make it a bit small.
Thanks!
I have auto ID set in asp.Net. My hyperlink's ID is way too big ctl00_Body_grvDocs_ctl45_hypDocNav
How can I reduce the ID's length? I want to keep it auto but atleast make it a bit small.
Thanks!
No, You can do it.
The way the id is generated is all the parents are appended in the id, if you do it auto. That means your HyperLink which is hypDocNav
is inside ct145
which inside a grvDocs
and so on
Investigate the ClientIDMode property: http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode.aspx
If you set ClientIDMode="Static"
, your id will match in the rendered HTML, but you have the opportunity to have hyperlinks with the same ID, which will break a lot of the features of ASP.NET PostBack. Check the link above and choose the setting right for you.