国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

.net 用戶控件ascx.cs注冊js腳本代碼無效果

??? 2016-11-09 15:53:59 478
????:在.net web項目中碰到一個比較奇怪的問題,網(wǎng)上沒找到解決方案,先自己mark一下問題描述:添加一個用戶控件ascx,在后端.cs添加js注冊腳本,執(zhí)行后沒有彈出框注冊腳本為:this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script typ

在.net web項目中碰到一個比較奇怪的問題,網(wǎng)上沒找到解決方案,先自己mark一下

問題描述:

添加一個用戶控件ascx,在后端.cs添加js注冊腳本,執(zhí)行后沒有彈出框

注冊腳本為:

this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('提示');</script>");this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('提示');</script>");

網(wǎng)上找了些資料都是在aspx的后端cs頁面添加注冊代碼

ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('提示');</script>");

在aspx頁面的后端cs頁面注冊的腳本執(zhí)行后會彈出alert框

對比兩段代碼個人覺得是因為在ascx.cs頁面的this.Page沒有取到當前的aspx頁面,腳本沒有注冊成功,但是打斷點執(zhí)行的時候this.Page顯示的是當前aspx頁面,所以不明白哪里出問題了


??? ??

?? ??