How to removing Run time generated controls id.

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.
 
S

Sean Chambers

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
 
J

Jason Kester

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top