How to removing Run time generated controls id.

  • Thread starter Thread starter sanjib.prasad
  • Start date Start date
S

sanjib.prasad

Hi,

I am working with new web based control tool. To make a new tool of
accordion of mulitpanel. What happen when i creating any sub panel
under top panel. then system create a run time generated contraol id .
with My given given Id Like Ctrl01_subAccordionPanel11. The
subAccordionPanel11 is given by me But i wont want system generated id
that is Ctrl01_ is there is any method to stop system generated Id of
every control.

sanjib
Soft Enng.
 
Is there a valid reason why you do not want it to generate this?

You can always find the actual control of the ID by doing FindControl

If you really need to generate your own control ids, you could probably
do it by hooking into and overriding the control generation process in
the page lifecycle, might be a little more trouble than its worth.

Sorry I couldnt provide more info, I've never had to do this, I'm
actually interested to see if it is possible to do. Please let me know
what you find.

Hope that helps!

Sean
 
But i wont want system generated id
that is Ctrl01_ is there is any method to stop system generated Id of
every control.


There's not much you can do about this, and it makes writing
client-side script a bit more painful that it should be. I usually end
up working around it with a bunch of declarations such as:

var txtUsername = '<%=txtUsername.ClientID%>';
var hdPageIndex = '<%=hdPageIndex.ClientID%>';

This works for the basic case, and will get you most of the way there.
For repeating controls inside a parent, you can spit out the ClientID
for the container control, then put together a child id with some text
concatenation.

Good luck!

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
 
Back
Top