T
Ted Ngo
Hi All,
I am trying to pass the text and value from the listbox of my child
window to my listbox of parent window (this listbox is in gridview
control - Multiple listbox in this control). I were able to that, but
when I click on other button to make the popup window come up (in the
same gridview) then the value in the previous listbox (parent window)
goes away, if I don't refresh my parent page then the value is still
there. Some one suggests using hidden filed but I am not sure how,
please help Below is the code in my parent window and child page:
Parent:
<script language="JavaScript" type="text/JavaScript">
function NewOption(CtrlID, TxtValue, ValueID)
{
var objsel = document.getElementById(CtrlID);
var lobjOption = document.createElement("OPTION");
lobjOption.value = ValueID;
lobjOption.text = TxtValue;
objsel.options.add(lobjOption);
}
function MyPopUpWindow()
{
window.open(mypage,myname,settings);
lovwin.focus();
}
<asp:GridView>
<asp:TemplateField>
<ItemTemplate>
<asp:ListBox runat=server id=lstdata Width=225px Rows=1>
</asp:ListBox>
<asp:ImageButton ImageUrl="~/images/selection.gif"
runat=server ID=btnlov OnClientClick=" MyPopUpWindow();" />
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
PopupWindow:
function PostBackData()
{
var source=document.getElementById("listboxdata");
var controlID = '<%=txtboxID %>'
var maxItems = source.options.length;
for (i=0;i<maxItems;i++)
{
if (source.options.selected==true)
{
window.opener.NewOption(controlID, source.options.text,
source.options.value);
}
}
window.opener.focus();
window.close();
}
Please help.
I am trying to pass the text and value from the listbox of my child
window to my listbox of parent window (this listbox is in gridview
control - Multiple listbox in this control). I were able to that, but
when I click on other button to make the popup window come up (in the
same gridview) then the value in the previous listbox (parent window)
goes away, if I don't refresh my parent page then the value is still
there. Some one suggests using hidden filed but I am not sure how,
please help Below is the code in my parent window and child page:
Parent:
<script language="JavaScript" type="text/JavaScript">
function NewOption(CtrlID, TxtValue, ValueID)
{
var objsel = document.getElementById(CtrlID);
var lobjOption = document.createElement("OPTION");
lobjOption.value = ValueID;
lobjOption.text = TxtValue;
objsel.options.add(lobjOption);
}
function MyPopUpWindow()
{
window.open(mypage,myname,settings);
lovwin.focus();
}
<asp:GridView>
<asp:TemplateField>
<ItemTemplate>
<asp:ListBox runat=server id=lstdata Width=225px Rows=1>
</asp:ListBox>
<asp:ImageButton ImageUrl="~/images/selection.gif"
runat=server ID=btnlov OnClientClick=" MyPopUpWindow();" />
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
PopupWindow:
function PostBackData()
{
var source=document.getElementById("listboxdata");
var controlID = '<%=txtboxID %>'
var maxItems = source.options.length;
for (i=0;i<maxItems;i++)
{
if (source.options.selected==true)
{
window.opener.NewOption(controlID, source.options.text,
source.options.value);
}
}
window.opener.focus();
window.close();
}
Please help.