aspxgridveiw是devexpress的一個grid控件,使用起來還不錯。但是今天遇到一個問題,就是不能再 CustomButtonCallback 事件中使用response.write,因為CustomButtonCallback 事件是無刷新的,所以不支持,但是即使使用ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "MyScript", myScript, true)也無濟于事,在網(wǎng)上查了很久,官方有個解決辦法,原文如下: 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:
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. 但是實際測試中發(fā)現(xiàn)了問題, throw 的時候后臺直接拋出錯誤了,,這個方法也行不通,再找。。。 最終還是在官網(wǎng)上找到了解決方案,原文地址,我的代碼如下: