開新+關閉視窗,網頁傳值

  • 3194
  • 0
  • C#
  • 2011-03-04

摘要:開新+關閉視窗,網頁傳值


//開新視窗
按鈕ID.Attributes.Add("onclick", string.Format("window.open('檔名.aspx?controlID={0}','CSETHR','height=300, width=300, top=200, left=200, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no'); return false;", 控制項.ClientID));

//網頁傳值
        if (!IsPostBack)
        {
            if (Request["controlID"] != null)
            { lblControlID.Text = Request["controlID"].ToString();
            else
            { lblControlID.Text = "資料異常!";
        }
//btnSubMit_Click:
this.Page.Controls.Add(new LiteralControl(string.Format("

", Calendar1.SelectedDate.ToString("yyyyMMdd"), lblControlID.Text)));
this.Page.Controls.Add(new LiteralControl("

")); //關閉此視窗