Return Values from Popup to UserControl

R

ruca

Hi,

Can anyone tell me please how can I return values from a popup to a
UserControl. I use the same "method" like to return to a WebForm, but it not
works in UserControl case.


I have this code to return from popup to webform:
------------------------------------------------------------------------
sbScript.Append("<script language='javascript'>")
sbScript.Append(Environment.NewLine)
sbScript.Append("window.opener.document.forms[0].elements['")
sbScript.Append(Request.QueryString("srcA"))
sbScript.Append("'].value = '")
sbScript.Append(strYear)
sbScript.Append("';")

sbScript.Append(Environment.NewLine)
sbScript.Append("window.opener.document.forms[0].elements['")
sbScript.Append(Request.QueryString("srcM"))
sbScript.Append("'].value = '")
sbScript.Append(strMonth)
sbScript.Append("';")

sbScript.Append(Environment.NewLine)
sbScript.Append("window.opener.document.forms[0].elements['")
sbScript.Append(Request.QueryString("srcD"))
sbScript.Append("'].value = '")
sbScript.Append(strDay)
sbScript.Append("';")

sbScript.Append(Environment.NewLine)
sbScript.Append("window.close();")
sbScript.Append(Environment.NewLine)
sbScript.Append("</script>")
RegisterStartupScript("CloseDate", sbScript.ToString())
------------------------------------------------------------------------


--
Programming ASP.NET with VB.NET

Thank's (if you try to help me)
Hope can help (if I try to help)

ruca
 
L

Laurent Bugnion

Hi,
Hi,

Can anyone tell me please how can I return values from a popup to a
UserControl. I use the same "method" like to return to a WebForm, but it not
works in UserControl case.

Usually, when something works for a Page but not for a Control, it's an
ID problem. Be aware that when a control gets added to the page, all its
children controls get a different ID from the one set using the ID
attribute. This is to guarantee that all the IDs on the page are unique.

Inspect your produced HTML code using view-source. The control's unique
ID can be obtained on the server using myControl.ClientID.
I have this code to return from popup to webform:

Deprecated. Use

<script type="text/javascript">

instead.

HTH,
Laurent
 
R

ruca

Hi,

But this control is used in many pages
How can I specifief or pass the ID into my UserControl, since is this that
opens my popup????



--
Programming ASP.NET with VB.NET

Thank's (if you try to help me)
Hope can help (if I try to help)

ruca
 

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

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top