|
Carrying over of text to popup box -- Caameo --
Hi there.. I have a Webform1.aspx (Parent window) with 'TextBoxComments' control on it. I have another webform PopupComments.aspx (Child window) with TexBox1 and OK button. When user clicks on this 'TextBoxComments' of parent window..i am opening child window popup box using javascript shown below. User will enter few comments in TexBox1 of child window and when he clicks OK button..those comments will be carried over to Parent window. Everything works fine as expected. Now when user clicks on 'TextBoxComments' of Parent window...the comments which are already there should be carried over to child window TextBox1. Can some one help me with your inputs on how to do it?? Page_Load( ) of Webform1.aspx : ------------------------------------------------ this.TextBoxComments.Attributes.Add("onclick", "var strReturn; strReturn=window.showModalDialog('PopupComments.aspx',null,'status:no;dialogWidth:380px;dialogHeight:250px;dialogHide:true;help:no;scroll:no');if (strReturn != null) document.getElementById('TextBoxComments').value=strReturn;"); Page_Load( ) of PopupBoxComment.aspx: ------------------------------------------------------------ this.ButtonOK.Attributes.Add("onclick", "window.returnValue = document.getElementById('TextBox1').value; window.close();"); |
|
-- Caameo --
Friends.. Thanks...i got the answer. --Caameo |
|
-- Cerebrus --
Then you should post it here, for the benefit of others who might be searching for the same. |
|
-- sivaramakota --
Caameo please post ur answer so that all of us here can abt it Cheers!! DotNet Rocker On 7/13/06, Cerebrus <zorg007> wrote: Then you should post it here, for the benefit of others who might be searching for the same. > -- Regards, Sivaram |
|
-- Caameo --
Hi friends... Here is the solution. Parent window will have below code.. this.TextBoxComments.Attributes.Add("onclick", "var strReturn; strReturn=window.showModalDialog('PopupComments.aspx',document.getElementById('TextBoxComments').value,'status:no;dialogWidth:380px;dialogHeight:250px;dialogHide:true;help:no;scroll:no');if (strReturn != null) document.getElementById('TextBoxComments').value=strReturn;"); Notice second argument of 'window.showModalDialog' method. We are passing on TextBoxComments as an argument and have to access it on child window as shown below. string strScript = "<script>document.getElementById('TextBox1').value = window.dialogArguments;</script>"; this.RegisterStartupScript("ClientScript", strScript); Hope this helps. -- Caameo |