2012年11月2日 星期五
Dialog 開啟新視窗傳值
Step.1 page_load in code
this.Button1.Attributes.Add("OnClick", "return getRelPeople('" + this.returndata.ClientID.ToString() + "','" + this.Session["LoginID"].ToString() + "','" + this.Session["CASE_CUSTSYSID"].ToString() + "');");
Step.2 js
function getRelPeople(Target, LoginID, CUST_SYSID) {
var width = screen.availWidth;
var height = screen.availHeight - 50;
var returnValue = window.showModalDialog("CASE_BROW_GET_XXXXX.aspx?LoginID=" + LoginID + "&CUST_SYSID=" + CUST_SYSID + "&wType=Case&TFB_Table=CFW_ORDER_TABLE", 'TradeList', "scrollbars=yes;location=no;resizable=yes;help=no;status=no;dialogHeight:" + height + "px;dialogwidth:" + width + "px;");
if (returnValue != null) {
window.document.getElementById(Target).value = returnValue;
return true; //&ChkFlg=Y
}
return false;
}
Step.3 CASE_BROW_GET_XXXXX.aspx
.....
.....
.....
string returndata = this.ViewState["GETCUST"].ToString();
ScriptManager.RegisterClientScriptBlock(this.Page, typeof(Page), "message", "javascript:sent2('" + returndata + "');window.close();", true);
return;
Step.4 js
function sent2(seletedValue) {
window.returnValue = seletedValue;
}
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言