how to get the reference of the form in ascx

P

Pattabi

Hi!!!!!!!
I have aspx page which uses ascx(usercontrol) in it.
The ascx in turn contains a textbox and a button. if i click
the button, javascript code get executed to open another popup window,
in that code i am passing the form name , control name of the text
box. After few operations are performed in that popup window, when i
try to close the popup window, i am setting the value of the texbox in
ascx from the popup window using javascript

window.opener.document.forms[ said:
"].value = "<%= strSelectedDate %>";

it's giving me the error as
window.open.document.forms["abc"].txtbox.value is null or not an
object,

From the above error, I think the reference is lost to the form.

It works fine when I am not using any ascx(usercontrol) in my aspx
page and opening directly popup window from the aspx page.

Can someone help me out in this!!!!!!!!!!!!!!!!!

thanks
dharani
 
S

S. Justin Gengo

Pattabi,

Have you placed form tags inside of your user control?

Asp.Net breaks if there is more than one set of form tags on a page. So you
aren't supposed to create a page, and then add a usercontrol with form tags
to it.

If indeed your user control does have form tags in it, remove them and then
just refer to the form as:

window.opener.document.Form1

You shouldn't even need to track the form name if you just stick with the
default form id that .Net assigns.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche


Pattabi said:
Hi!!!!!!!
I have aspx page which uses ascx(usercontrol) in it.
The ascx in turn contains a textbox and a button. if i click
the button, javascript code get executed to open another popup window,
in that code i am passing the form name , control name of the text
box. After few operations are performed in that popup window, when i
try to close the popup window, i am setting the value of the texbox in
ascx from the popup window using javascript

window.opener.document.forms[ said:
"].value = "<%= strSelectedDate %>";

it's giving me the error as
window.open.document.forms["abc"].txtbox.value is null or not an
object,

From the above error, I think the reference is lost to the form.

It works fine when I am not using any ascx(usercontrol) in my aspx
page and opening directly popup window from the aspx page.

Can someone help me out in this!!!!!!!!!!!!!!!!!

thanks
dharani
 

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

Top