I have played enough with this. I need help.

Discussion in 'ASP .Net' started by =?Utf-8?B?Q2hyaXM=?=, Nov 11, 2004.

  1. Hi,
    I have a parent page that loads a popup and when the OK button is press it
    pass the value back to the parent form textbox. It passes the value but it
    doesn't close the popup but also open another copy of the popup. Guys I
    checked everywhere. I get the same thing.

    This is the code on the parent form webform1.aspx

    HTML

    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 240px; POSITION:
    absolute; TOP: 144px" runat="server"
    Text="Button"></asp:Button>
    <asp:TextBox id="txtValue" style="Z-INDEX: 102; LEFT: 240px; POSITION:
    absolute; TOP: 104px"
    runat="server"></asp:TextBox>
    </form>
    </body>



    VB CODE



    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    Button1.Attributes.Add("onclick", "var strReturn;
    strReturn=window.showModalDialog('child.aspx',null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');if
    (strReturn != null) document.getElementById('txtValue').value=strReturn;")




    End Sub

    This is the code for the child (popup) child.aspx

    HTML

    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:TextBox id="txtValue" style="Z-INDEX: 101; LEFT: 224px; POSITION:
    absolute; TOP: 104px"
    runat="server"></asp:TextBox>
    <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 224px; POSITION:
    absolute; TOP: 144px" runat="server"
    Text="Button"></asp:Button>
    <asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 296px; POSITION:
    absolute; TOP: 144px" runat="server"
    Text="Button"></asp:Button>
    </form>
    </body>


    VB CODE

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here

    Button1.Attributes.Add("onclick", "window.returnValue =
    document.getElementById('txtValue').value; window.close();")

    Button2.Attributes.Add("onclick", "window.close();")
    End Sub



    I would really appreciate any help on this. I gave it my best shot.

    Thanks
     
    =?Utf-8?B?Q2hyaXM=?=, Nov 11, 2004
    #1
    1. Advertising

  2. Hi Chris,

    In your popup add a <head> tag like this:

    <Head>
    <BASE target="_self">
    </Head>

    The problem is that with out the target tag your popup will act funny when
    it posts back to itself because it is Modal. Good luck! Ken.

    --
    Ken Dopierala Jr.
    For great ASP.Net web hosting try:
    http://www.webhost4life.com/default.asp?refid=Spinlight
    If you sign up under me and need help, email me.

    "Chris" <> wrote in message
    news:...
    > Hi,
    > I have a parent page that loads a popup and when the OK button is press it
    > pass the value back to the parent form textbox. It passes the value but it
    > doesn't close the popup but also open another copy of the popup. Guys I
    > checked everywhere. I get the same thing.
    >
    > This is the code on the parent form webform1.aspx
    >
    > HTML
    >
    > <body MS_POSITIONING="GridLayout">
    > <form id="Form1" method="post" runat="server">
    > <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 240px; POSITION:
    > absolute; TOP: 144px" runat="server"
    > Text="Button"></asp:Button>
    > <asp:TextBox id="txtValue" style="Z-INDEX: 102; LEFT: 240px; POSITION:
    > absolute; TOP: 104px"
    > runat="server"></asp:TextBox>
    > </form>
    > </body>
    >
    >
    >
    > VB CODE
    >
    >
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    >
    > Button1.Attributes.Add("onclick", "var strReturn;
    >

    strReturn=window.showModalDialog('child.aspx',null,'status:no;dialogWidth:37
    0px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');if
    > (strReturn != null) document.getElementById('txtValue').value=strReturn;")
    >
    >
    >
    >
    > End Sub
    >
    > This is the code for the child (popup) child.aspx
    >
    > HTML
    >
    > <body MS_POSITIONING="GridLayout">
    > <form id="Form1" method="post" runat="server">
    > <asp:TextBox id="txtValue" style="Z-INDEX: 101; LEFT: 224px; POSITION:
    > absolute; TOP: 104px"
    > runat="server"></asp:TextBox>
    > <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 224px; POSITION:
    > absolute; TOP: 144px" runat="server"
    > Text="Button"></asp:Button>
    > <asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 296px; POSITION:
    > absolute; TOP: 144px" runat="server"
    > Text="Button"></asp:Button>
    > </form>
    > </body>
    >
    >
    > VB CODE
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    > 'Put user code to initialize the page here
    >
    > Button1.Attributes.Add("onclick", "window.returnValue =
    > document.getElementById('txtValue').value; window.close();")
    >
    > Button2.Attributes.Add("onclick", "window.close();")
    > End Sub
    >
    >
    >
    > I would really appreciate any help on this. I gave it my best shot.
    >
    > Thanks
    >
    >
     
    Ken Dopierala Jr., Nov 11, 2004
    #2
    1. Advertising

  3. Hi Chris,

    I forgot, also do this, it doesn't look like you are even expecting to post
    back, but you are:

    Button1.Attributes.Add("onclick", "window.returnValue =
    document.getElementById('txtValue').value; window.close(); return false;")

    Button2.Attributes.Add("onclick", "window.close(); return false;")

    Without the 'return false;', those buttons are causing a post back. Good
    luck! Ken.

    --
    Ken Dopierala Jr.
    For great ASP.Net web hosting try:
    http://www.webhost4life.com/default.asp?refid=Spinlight
    If you sign up under me and need help, email me.


    "Ken Dopierala Jr." <> wrote in message
    news:...
    > Hi Chris,
    >
    > In your popup add a <head> tag like this:
    >
    > <Head>
    > <BASE target="_self">
    > </Head>
    >
    > The problem is that with out the target tag your popup will act funny when
    > it posts back to itself because it is Modal. Good luck! Ken.
    >
    > --
    > Ken Dopierala Jr.
    > For great ASP.Net web hosting try:
    > http://www.webhost4life.com/default.asp?refid=Spinlight
    > If you sign up under me and need help, email me.
    >
    > "Chris" <> wrote in message
    > news:...
    > > Hi,
    > > I have a parent page that loads a popup and when the OK button is press

    it
    > > pass the value back to the parent form textbox. It passes the value but

    it
    > > doesn't close the popup but also open another copy of the popup. Guys I
    > > checked everywhere. I get the same thing.
    > >
    > > This is the code on the parent form webform1.aspx
    > >
    > > HTML
    > >
    > > <body MS_POSITIONING="GridLayout">
    > > <form id="Form1" method="post" runat="server">
    > > <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 240px; POSITION:
    > > absolute; TOP: 144px" runat="server"
    > > Text="Button"></asp:Button>
    > > <asp:TextBox id="txtValue" style="Z-INDEX: 102; LEFT: 240px; POSITION:
    > > absolute; TOP: 104px"
    > > runat="server"></asp:TextBox>
    > > </form>
    > > </body>
    > >
    > >
    > >
    > > VB CODE
    > >
    > >
    > >
    > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles MyBase.Load
    > >
    > > Button1.Attributes.Add("onclick", "var strReturn;
    > >

    >

    strReturn=window.showModalDialog('child.aspx',null,'status:no;dialogWidth:37
    > 0px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');if
    > > (strReturn != null)

    document.getElementById('txtValue').value=strReturn;")
    > >
    > >
    > >
    > >
    > > End Sub
    > >
    > > This is the code for the child (popup) child.aspx
    > >
    > > HTML
    > >
    > > <body MS_POSITIONING="GridLayout">
    > > <form id="Form1" method="post" runat="server">
    > > <asp:TextBox id="txtValue" style="Z-INDEX: 101; LEFT: 224px; POSITION:
    > > absolute; TOP: 104px"
    > > runat="server"></asp:TextBox>
    > > <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 224px; POSITION:
    > > absolute; TOP: 144px" runat="server"
    > > Text="Button"></asp:Button>
    > > <asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 296px; POSITION:
    > > absolute; TOP: 144px" runat="server"
    > > Text="Button"></asp:Button>
    > > </form>
    > > </body>
    > >
    > >
    > > VB CODE
    > >
    > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles MyBase.Load
    > > 'Put user code to initialize the page here
    > >
    > > Button1.Attributes.Add("onclick", "window.returnValue =
    > > document.getElementById('txtValue').value; window.close();")
    > >
    > > Button2.Attributes.Add("onclick", "window.close();")
    > > End Sub
    > >
    > >
    > >
    > > I would really appreciate any help on this. I gave it my best shot.
    > >
    > > Thanks
    > >
    > >

    >
    >
     
    Ken Dopierala Jr., Nov 11, 2004
    #3
  4. Once again I live to tell the tail! Thanks! Worked perfect.

    Where can I find info on using these javascript with asp.net

    "Ken Dopierala Jr." wrote:

    > Hi Chris,
    >
    > In your popup add a <head> tag like this:
    >
    > <Head>
    > <BASE target="_self">
    > </Head>
    >
    > The problem is that with out the target tag your popup will act funny when
    > it posts back to itself because it is Modal. Good luck! Ken.
    >
    > --
    > Ken Dopierala Jr.
    > For great ASP.Net web hosting try:
    > http://www.webhost4life.com/default.asp?refid=Spinlight
    > If you sign up under me and need help, email me.
    >
    > "Chris" <> wrote in message
    > news:...
    > > Hi,
    > > I have a parent page that loads a popup and when the OK button is press it
    > > pass the value back to the parent form textbox. It passes the value but it
    > > doesn't close the popup but also open another copy of the popup. Guys I
    > > checked everywhere. I get the same thing.
    > >
    > > This is the code on the parent form webform1.aspx
    > >
    > > HTML
    > >
    > > <body MS_POSITIONING="GridLayout">
    > > <form id="Form1" method="post" runat="server">
    > > <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 240px; POSITION:
    > > absolute; TOP: 144px" runat="server"
    > > Text="Button"></asp:Button>
    > > <asp:TextBox id="txtValue" style="Z-INDEX: 102; LEFT: 240px; POSITION:
    > > absolute; TOP: 104px"
    > > runat="server"></asp:TextBox>
    > > </form>
    > > </body>
    > >
    > >
    > >
    > > VB CODE
    > >
    > >
    > >
    > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles MyBase.Load
    > >
    > > Button1.Attributes.Add("onclick", "var strReturn;
    > >

    > strReturn=window.showModalDialog('child.aspx',null,'status:no;dialogWidth:37
    > 0px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');if
    > > (strReturn != null) document.getElementById('txtValue').value=strReturn;")
    > >
    > >
    > >
    > >
    > > End Sub
    > >
    > > This is the code for the child (popup) child.aspx
    > >
    > > HTML
    > >
    > > <body MS_POSITIONING="GridLayout">
    > > <form id="Form1" method="post" runat="server">
    > > <asp:TextBox id="txtValue" style="Z-INDEX: 101; LEFT: 224px; POSITION:
    > > absolute; TOP: 104px"
    > > runat="server"></asp:TextBox>
    > > <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 224px; POSITION:
    > > absolute; TOP: 144px" runat="server"
    > > Text="Button"></asp:Button>
    > > <asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 296px; POSITION:
    > > absolute; TOP: 144px" runat="server"
    > > Text="Button"></asp:Button>
    > > </form>
    > > </body>
    > >
    > >
    > > VB CODE
    > >
    > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles MyBase.Load
    > > 'Put user code to initialize the page here
    > >
    > > Button1.Attributes.Add("onclick", "window.returnValue =
    > > document.getElementById('txtValue').value; window.close();")
    > >
    > > Button2.Attributes.Add("onclick", "window.close();")
    > > End Sub
    > >
    > >
    > >
    > > I would really appreciate any help on this. I gave it my best shot.
    > >
    > > Thanks
    > >
    > >

    >
    >
    >
     
    =?Utf-8?B?Q2hyaXM=?=, Nov 11, 2004
    #4
    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. Mark C
    Replies:
    1
    Views:
    365
    mank1327
    Jan 8, 2007
  2. alf
    Replies:
    0
    Views:
    262
  3. Matrixinline
    Replies:
    1
    Views:
    560
    red floyd
    May 22, 2009
  4. Mark C
    Replies:
    1
    Views:
    127
    Evertjan.
    Jan 8, 2007
  5. Robin Wagenaar

    top 10 last played mp3's

    Robin Wagenaar, Oct 13, 2007, in forum: Ruby
    Replies:
    17
    Views:
    207
    Brian Adkins
    Oct 14, 2007
Loading...

Share This Page