将值从Repeater控件的弹出窗口传递到父窗体的TextBox [英] Pass value from popup window in Repeater control to parent form's TextBox
本文介绍了将值从Repeater控件的弹出窗口传递到父窗体的TextBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
如何将值从Repeater控件的弹出窗口传递到父窗体的TextBox?
以下数据是父窗口:
Hi all,
How to pass a value from popup window in Repeater control to parent form''s TextBox?
Following data is parent window:
<asp:TextBox ID="txtInsuranceName" runat="server" MaxLength="24"></asp:TextBox>
<asp:ImageButton runat="server" CommandArgument="AutoSearch" CommandName="AutoSearch" ID="imgAutoSearch" ImageUrl="~/Images/search.gif" />
以下数据是弹出窗口数据:
Following data is popup window data:
<%#DataBinder.Eval(Container.DataItem, "InsCarrierName")%>
<asp:Button runat="server" ID="btnSelect" Text="Select" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "InsCarrierId")%>' CommandName="Select" />
推荐答案
Use Session variable to store the value from popup , and access it in the parent page
Before closing the popup ,store the desired value in a Session variable:
Session["Data"]="DesiredValue";
After returning to the parent page ,get value from the Session Variable:
txtInsuranceName.Text=Session["Data"].ToString();
:-D
现在解决了问题..也使用了下面的代码...使用了Repeater控件..
Now Solved the problem..also used below code...using the Repeater control..
<script type="text/javascript" language="javascript">
function GetRowValue(val,name) {
// hardcoded value used to minimize the code.
// ControlID can instead be passed as query string to the popup window
window.opener.getRowvaluepopup(val,name);
window.close();
}
</script>
function openpopup() {
window.open("http://localhost:3438/AutoComplete/popupPatInsurance.aspx", "List", "scrollbars=no,resizable=no,width=400,height=280");
return false;
}
function getRowvaluepopup(val,name) {
//window.opener.document.getElementById("ctl00
body
这篇关于将值从Repeater控件的弹出窗口传递到父窗体的TextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文