电竞比分网-中国电竞赛事及体育赛事平台

分享

總結(jié)C# ----后臺彈出窗體和打開網(wǎng)頁的不同方法,以及關(guān)閉網(wǎng)頁的方法. .

 在知識中沉淀 2013-04-11
.控件再UpLoad中,彈出窗口
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert('!');", js, true);

2.控件不再UpLoad中,彈出窗口
            Page.RegisterStartupScript("Messages", "<script>alert('OK'')</script>");

3.彈出新的網(wǎng)頁

            Response.Redirect("'Default.aspx");

            Response.Redirect("'Default.aspx?id=" + this.GridView1.SelectedDataKey.Value.ToString());


4.利用前臺注冊腳本彈出固定大小的頁面

            AutoId.Attributes.Add("onclick", "window.open('Default.aspx?AutoID=" +
                SetupList.DataKeys[e.Row.RowIndex][0].ToString() + "','','height=500,width=400px,top=100,left=200,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no');");

            注:AutoId為服務(wù)器控件可以為LinkButton控件

 

5.注冊前臺事件,關(guān)閉彈出窗體,并且刷新父窗體(結(jié)合4使用.)

            ClientScript.RegisterClientScriptBlock(this.GetType(), "closeWindow", "CloseWindowReflash()", true);

            前臺js函數(shù)

            function CloseWindowReflash()
            {
                window.opener.parent.document.frames.item('frame').location.reload();
                window.close();

            }

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多