Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Return Values from Popup to UserControl

Reply
Thread Tools

Return Values from Popup to UserControl

 
 
ruca
Guest
Posts: n/a
 
      12-14-2006
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


 
Reply With Quote
 
 
 
 
Laurent Bugnion
Guest
Posts: n/a
 
      12-14-2006
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
 
Reply With Quote
 
 
 
 
ruca
Guest
Posts: n/a
 
      12-14-2006
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

"Laurent Bugnion" <(E-Mail Removed)> escreveu na mensagem
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Unpack less values from function's return values Chris Rebert Python 1 05-28-2009 02:47 PM
Return Values from Popup to UserControl ruca ASP .Net 2 12-14-2006 12:32 PM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM
Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack huobazi ASP .Net 1 07-03-2003 03:14 AM



Advertisments