最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

aspxgridview CustomButtonCallback 不支持彈出消息提示解決方法

 更新時(shí)間:2013年06月21日 16:23:17   作者:  
aspxgridveiw是devexpress的一個(gè)grid控件,使用起來還不錯(cuò),不能再 CustomButtonCallback 事件中使用response.write,具體的解決方法如下,感興趣的朋友可以參考下哈
aspxgridveiw是devexpress的一個(gè)grid控件,使用起來還不錯(cuò)。但是今天遇到一個(gè)問題,就是不能再 CustomButtonCallback 事件中使用response.write,因?yàn)镃ustomButtonCallback 事件是無刷新的,所以不支持,但是即使使用ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "MyScript", myScript, true)也無濟(jì)于事,在網(wǎng)上查了很久,官方有個(gè)解決辦法,原文如下:
Hi Troy;
To provide this functionality you should throw an exception in the CustomButtonCallback event handler and process this exception in the CallbackError event handler. Here is the simple sample:
復(fù)制代碼 代碼如下:

protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonCallbackEventArgs e)
{
throw new Exception("Here I am!");
}

復(fù)制代碼 代碼如下:

if (e.message == 'Here I am!')
{
clientErrorImage.SetVisible(true);
}

If this answer is incomplete or I misunderstood your requirements, please let me know.
Thanks
Kate.
但是實(shí)際測(cè)試中發(fā)現(xiàn)了問題, throw 的時(shí)候后臺(tái)直接拋出錯(cuò)誤了,,這個(gè)方法也行不通,再找。。。
最終還是在官網(wǎng)上找到了解決方案,原文地址,我的代碼如下:
復(fù)制代碼 代碼如下:

protected void ASPxGridView1_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
{
ASPxGridView view = sender as ASPxGridView;
if (e.ButtonID == "btnAudit")
{
int id = 0;
int.TryParse(view.GetRowValues(e.VisibleIndex, "id").ToString(), out id);
if (true)
{
view.JSProperties["cpErrorMsg"] = "審核成功!";
view.DataBind();
}
else
{
view.JSProperties["cpErrorMsg"] = "此單據(jù)已經(jīng)審核!";
}
}
}

復(fù)制代碼 代碼如下:

function EndCallBack(s, e) {
if (s.cpErrorMsg!="") {
alert(s.cpErrorMsg);
}
}

這里要注意:JSProperties的參數(shù)必須以小寫"cp"開頭。
測(cè)試通過,呵呵

相關(guān)文章

最新評(píng)論

开阳县| 兰州市| 渭源县| 西乡县| 朝阳市| 博客| 工布江达县| 武穴市| 安国市| 万山特区| 宁晋县| 辉县市| 滦平县| 乐亭县| 新龙县| 衡山县| 拉孜县| 博兴县| 云林县| 襄垣县| 阜平县| 青州市| 磐安县| 柘荣县| 永清县| 达拉特旗| 泾源县| 郁南县| 西和县| 屯留县| 惠州市| 凯里市| 祁门县| 昌黎县| 涡阳县| 大悟县| 昭苏县| 武安市| 邢台县| 英山县| 松原市|