parent.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
// 子視窗回 call 父視窗 javascript function __doPostBack
if (IsPostBack)
{
InformationCenter info = InformationCenter.GetInstance();
EmployeeService emService = info.GetEmployeeService();

// 如果是自己定義的 Event 就更新 GridView
string str = Request.Params["__MyEVENTTARGET"];
if (str == "GetSearchResult")
{
//抓取搜尋結果並顯示
gvEmployee.DataSource = emService.GetSearchResult();
gvEmployee.DataBind();
}
else if (str == "DeleteEmployee")
{
DataTable dt = emService.GetSearchResult();
for (int i = gvEmployee.Rows.Count - 1; i >= 0; i--)
{
//移除已刪除的項目
if (((CheckBox)gvEmployee.Rows[i].FindControl("cbDelete")).Checked)
{
dt.Rows.RemoveAt(i);
}
}
gvEmployee.DataSource = dt;
gvEmployee.DataBind();
}
}
}

parent.aspx
function GetResult()
{
__doPostBackforSearch('GetSearchResult','');
}
function DeleteEmployee()
{
__doPostBackforSearch('DeleteEmployee','');
}

son.aspx.cs
Response.Write("<>包起來 script language=\"javascript\"
window.opener.GetResult(); window.close();
<>包起來 /script");
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 JohnDX 的頭像
    JohnDX

    我要回家想一想~

    JohnDX 發表在 痞客邦 留言(0) 人氣()