finding the form that owns the usercontrol

K

Karl Prosser

i have various usercontrols that get dynamically into a page
my usercontrol has html Input fields,
and from javascript i need to access them, however to access them i
need to know the form..
currently the code i use to generate the javascript i do for example

....
document.forms[0]." + GRIDENTER.ClientID + @".value= 'YES';
....
(gridenter is a htmlinputtext )

which works, however what if there is more than one form in the host
page
surely there is a way i can get the clientID of the controls host
form.

Karl
 
S

Scott Allen

I think I understand what you are asking, and you might be looking to
do more work than you need. ASP.NET generates the ClientID so it is
always unique.

If you are worrying about multiple forms appearing on an aspx page, be
aware that aspx pages allow only one server side form tag, so this
should not present a problem either.

This article goes into some more detail on both subjects:
Form-based Programming in ASP.NET
http://msdn.microsoft.com/msdnmag/issues/03/05/CuttingEdge/default.aspx

HTH,
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top