ASPXGRIDVEIW is a grid control for DevExpress, and it's good to use. Today, however, there is a problem that you cannot use Response.Write in Custombuttoncallback events because the Custombuttoncallback event is not refreshed, so it is not supported, But even with Scriptmanager.registerclientscriptblock (page, page). GetType (), "MyScript", MyScript, true) also did not help, the online search for a long time, the official has a solution, the original text is as follows:
Hi Troy;
To provide this functionality you should throw a exception in the Custombuttoncallback event handler and process this exc Eption in the Callbackerror event handler. Here are the simple sample:
Copy Code code as follows:
protected void Aspxgridview1_custombuttoncallback (object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonCallbackEventArgs e)
{
throw new Exception ("Here I am!");
}
Copy Code code as follows:
if (e.message = = ' here I am! ')
{
Clienterrorimage.setvisible (TRUE);
}
If This answer are incomplete or I misunderstood your requirements, please let me know.
Thanks
Kate.
But the actual test found the problem, throw when the background directly thrown wrong, and this method is not workable, and then find ...
Finally found the solution on the official web, the original address, my code is as follows:
Copy Code code as follows:
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"] = "Audit success!" ";
View. DataBind ();
}
Else
{
View. jsproperties["cperrormsg"] = "This document has been approved!" ";
}
}
}
Copy Code code as follows:
function Endcallback (s, e) {
if (s.cperrormsg!= "") {
alert (s.cperrormsg);
}
}
Note here: The jsproperties parameter must begin with a lowercase "cp".
Test Pass, hehe