Hi Abdulla,
our code realyy makes sense but I don't know what i am doing wrong but I am not able to assign the selected value from the popup to an asp server control , however I am able to save it in an html hidden control. I have added both controls to show you how they act differently.
here is my code.
//This is the code in Pop up page page(Opener page) where the opening works fine.
<script type="text/javascript">
function RetrieveDialogArguments()
{
window.opener.document.getElementById("Hdnf1dhtml").value = document.getElementById("DropDownList1").value;
alert("The value is of the HTML hidden is: " + window.opener.document.getElementById("Hdnf1dhtml").value);
window.opener.document.getElementById("HdnfldASP").value = document.getElementById("DropDownList1").value;
alert("The value is of the ASP hidden is: " + window.opener.document.getElementById("HdnfldASP").value);
window.close();
}
</script>
<asp:Button ID="Button1" runat="server" Text="Close" OnClientClick='javascript:RetrieveDialogArguments();' />
Below is the code in the main page (Opener page) which is under a master page( I don’t know if this will make a difference.)
<script language="javascript" type="text/javascript">
function myopen() {
popupWindow=open('OptionList.aspx','window','resizable=no,width=400,height=300');
if (popupWindow.opener == null) popupWindow.opener = self;
}
function RefreshPage()
{
var varhtm = document.getElementById("Hdnf1dhtml" ).value;
}
</script>
<input type="text" size="40" name="Hdnf1dhtml" />
<asp:HiddenField ID="HdnfldASP" runat="server" />
<tr><td ><asp:Button ID="btnAdd" runat="server" CssClass="button" Text="Add Question" OnClick="btnAdd_Click" OnClientClick= 'javascript:RefreshPage();'/></td>
My first Question is :
In the Poup under the RetrieveDialog javascript code :
The alert with the Html control alerts me the selected value from the dropdown but the alert for the asp control does not get the dropdown value at all. Why ????
Second Question:
If the asp server control does not work I was trying to use the htmlhidden however i am not sure how I would read the data in my code behine.
Using the RefreshPage function which is a javascript on the main window I can read the varthm, however how would I be able to capture this value in a code behind under the btn_Add click event. Or how can I read the Hdnf1dhtml value in my code behind as I need to save this value in my database.
Thanks a lot
Tegest
Abdulla Abd Al Haq < abdulla_ah2001%40yahoo.com">abdulla_ah2001
yahoo.com> wrote:
Hi
at the first, you can pass values from popUp window to parent window using any server controls ( hiddenField, Textbox ...etc).
if you are using modalDialog, you can use (window.returnValue) to pass any value from the modal dialog just like that
//Using Modal Dialog
1- (parent page)
var x ;
x = showModalDialog('page1.aspx',window,'dialogHieght:250px;dialogWidth:366px');
2-(in ModalDialog page)
var myObj = dialogArguments;
//Now you got myObj object so you can do what you want in the parent window
window.returnvalue = document.getElementbyID("youControl").value
//Using PopuWindow
1- (parent page)
open the popWin
2-
window.opener.document.getElementById("hiddenField1").value = document.getElementById("control").value;
as I said you can use server control
I hope its help 
egest Tesfaye < tegestmelu%40yahoo.com">tegestmelu
yahoo.com> wrote:
Hello,
I am having a problem capturing data on a buttob click of a parent window which is passed from a pop up window.
Here is what I am doing.
I open a popup window which has a asp dropdown list and a button. On the button ClientClik I call a javascript which asssigns the value of the dropdown selected on the popup to an HTML hidden field on the parent window as a way of capturing the selected data from the popup window in the parent widow . If I use an asp hidden field on the parent form, assigning the value from the popup to the hidden field doesn't work using the Javascript