D
Denise
In ASP.Net, I am working with some in-house software that dynamically creates
a form based on rows in a database table. For example, most pages consist of
a header control, center control, and a footer control. By adding rows to
specific tables in the database, the form can be changed to add a breadcrumb
control or a calendar control.
I have discovered that for each new control that is added, ASP.Net adds a
_ctl# prefix. In javascript, when I need to reference a control, I can use
_ctl1_FirstName. Today my client side code stopped working because someone
added a calendar control to the form and now my textbox is _ctl2_FirstName.
Can anyone think of a way in Javascript to figure out what the prefix is for
a given control? Would the best approach be to loop through all the controls
to find the ones with a name I'm looking for? If so, does anyone have a
quick code sample?
It wouldn't be a problem if there were only one or two forms, but there are
many.
Thanks,
Denise
a form based on rows in a database table. For example, most pages consist of
a header control, center control, and a footer control. By adding rows to
specific tables in the database, the form can be changed to add a breadcrumb
control or a calendar control.
I have discovered that for each new control that is added, ASP.Net adds a
_ctl# prefix. In javascript, when I need to reference a control, I can use
_ctl1_FirstName. Today my client side code stopped working because someone
added a calendar control to the form and now my textbox is _ctl2_FirstName.
Can anyone think of a way in Javascript to figure out what the prefix is for
a given control? Would the best approach be to loop through all the controls
to find the ones with a name I'm looking for? If so, does anyone have a
quick code sample?
It wouldn't be a problem if there were only one or two forms, but there are
many.
Thanks,
Denise