Getting Form id in code behind

  • Thread starter Thread starter Makarand
  • Start date Start date
M

Makarand

Hi All

I have a asp.net User control which has sime client side
client scripting written in it at runtime.

Now my problem is, for this client script to woek properly
I need a Container form Id (i.e. <Form></Form> tag Id) so
that I can use syntax like document.formID.ControlId.value.

Can anybody tell me how to get the Form Id is code behind
at server side during runtime?

Thanx

Makarand
 
Makarand said:
Hi All

I have a asp.net User control which has sime client side
client scripting written in it at runtime.

Now my problem is, for this client script to woek properly
I need a Container form Id (i.e. <Form></Form> tag Id) so
that I can use syntax like document.formID.ControlId.value.

Can anybody tell me how to get the Form Id is code behind
at server side during runtime?

I believe you're going to have to search recursively in the Controls
collection of the page until you find the form, and then use
<form>.ClientID.
 

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

Back
Top