Return Values from Popup to UserControl

Discussion in 'ASP .Net Web Controls' started by ruca, Dec 14, 2006.

  1. ruca

    ruca Guest

    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
    ruca, Dec 14, 2006
    #1
    1. Advertising

  2. 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
    Laurent Bugnion, Dec 14, 2006
    #2
    1. Advertising

  3. ruca

    ruca Guest

    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" <> escreveu na mensagem
    news:...
    > 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
    ruca, Dec 14, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. huobazi
    Replies:
    1
    Views:
    668
    David Waz...
    Jul 3, 2003
  2. Rajesh Tiwari

    Can we use a usercontrol inside a usercontrol

    Rajesh Tiwari, Aug 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    400
    Rajesh Tiwari
    Aug 12, 2003
  3. ruca
    Replies:
    2
    Views:
    425
  4. Greenhorn
    Replies:
    15
    Views:
    800
    Keith Thompson
    Mar 6, 2005
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    500
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page