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.
 
Back
Top