我有两个aspax页面。client.aspxpopup.aspx
client.aspx包含一个简单的注册表格。在这个表格中,我必须从popup.aspx中获取一个文本框值。该文本框包含一个搜索按钮
当我点击搜索按钮popup.aspx页面会在弹出窗口中打开。
在popup.aspx中,我显示了一个网格,其中包含productCode和产品名称以及一个选择按钮。当我选择一行网格时,相应的产品名称应该显示在文本框中。并且应该关闭弹出窗口。
更新
ImageButton imgbut = sender as ImageButton;
GridViewRow gvr = (GridViewRow)imgbut.NamingContainer;
lblKeyIndex.Text = grd_ProductMaster.DataKeys[gvr.RowIndex].Value.ToString();
lblProductName.Text = gvr.Cells[2].Text;
Session["ProdName"] = lblProductName.Text;
Server.Transfer("client_Master.aspx");
Response.Write("<Script>window.close()</Script>"); Response.Redirect("client_Master.aspx?ProdName=" + lblProductName.Text+"&ProdCode="+lblKeyIndex.Text)
关于client.aspx 的页面加载
if (Session["ProdName"] != null)
{
txtSelectProdName.Text = Session["ProdName"].ToString();
}
打开弹出窗口
在弹出窗口中,尝试将值返回到父窗口。