Home All Groups Group Topic Archive Search About

Return Values from Popup to UserControl

Author
14 Dec 2006 12:14 PM
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

Author
14 Dec 2006 12:26 PM
Laurent Bugnion
Hi,

ruca wrote:
> 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:
> ------------------------------------------------------------------------
> sbScript.Append("<script language='javascript'>")

Deprecated. Use

<script type="text/javascript">

instead.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Are all your drivers up to date? click for free checkup

Author
14 Dec 2006 12:32 PM
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

Show quoteHide quote
"Laurent Bugnion" <galasoft***@bluewin.ch> escreveu na mensagem
news:uokJgs3HHHA.3676@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> ruca wrote:
>> 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:
>> ------------------------------------------------------------------------
>> sbScript.Append("<script language='javascript'>")
>
> Deprecated. Use
>
> <script type="text/javascript">
>
> instead.
>
> HTH,
> Laurent
> --
> Laurent Bugnion, GalaSoft
> Software engineering: http://www.galasoft-LB.ch
> PhotoAlbum: http://www.galasoft-LB.ch/pictures
> Support children in Calcutta: http://www.calcutta-espoir.ch

Bookmark and Share