子页面传值到父页面显示
父页面前台代码:
<td class="t1-mul" style="width: 135px">
帳戶名稱:</td>
<td class="t2">
<asp:TextBox ID="Tbx_AccountName" runat="server" Height="19px" Width="171px"></asp:TextBox>
<asp:Label id="Label1" runat="server"></asp:Label><a href="../CRM_Client_display.aspx?qe=Tbx_AccountName&qe2=Label1" onclick="return rForm(this, 400, 400);" class="highslide" id="lingbu"><img alt="" src="../img/crmsearch.gif" border="0" align="absmiddle" /></a>
td>
子页面前台代码:
<script>
function onSelect(zhanghao, owner){
parent.document.all("<%=qEleName%>").value=zhanghao;
parent.document.all("<%=qEleName2%>").value=owner;
parent.clo();
}
</script>
子页面后台代码:
this.qEleName = DFS.Web.PageBase.IsNullorEmpty(Page.Request.QueryString["qe"]) ? "txtclientname" : Page.Request.QueryString["qe"];
this.qEleName2 = DFS.Web.PageBase.IsNullorEmpty(Page.Request.QueryString["qe2"]) ? "Label1" : Page.Request.QueryString["qe2"];
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer)
{
e.Item.Attributes.Add("onmouseover","onmOer(this)" );
e.Item.Attributes.Add("onmouseout", "onmOut(this)");
string c = e.Item.Cells[0].Text;
e.Item.Cells[0].Text = "<a href=\"javascript:;\" title=\"選擇" + c + "\" onclick=\"onSelect('" + c + "', '" + e.Item.Cells[1].Text + "')\">" + c + "</a>";
}
}