Obout "onCallbackError" problem
I am using obout grid management in C # and not sure how to throw the error out of the code!
I caught the error in the code with a try catch block (which I can see what it does using breakpoints in visual studio) that I create specifically from the database (creating another entry with the same id) but cant seem to force this bring up an error message box!
Here's the code I'm working with:
void InsertRecord(object sender, GridRecordEventArgs e)
{
try
{
string[] value = new string[] {/*records to be added */};
connClass func = new connClass();
func.fnRecord(value, "rm_category_add");
}
catch (Exception ne)
{
//here the problem!!!!!!
}
}
I also set onCallbackerror to true, as you can see here:
protected void Page_Load(object sender, EventArgs e)
{
grid1.ID = "grid1";
grid1.CallbackMode = true;
grid1.Serialize = true;
grid1.AutoGenerateColumns = false;
grid1.AllowAddingRecords = true;
grid1.ShowLoadingMessage = true;
grid1.FolderStyle = "../css/style_13";
grid1.ClientSideEvents.OnClientCallback = "OnClientCallback";
grid1.ClientSideEvents.OnClientCallbackError = "onCallbackError";
grid1.ClientSideEvents.OnClientDblClick = "fn_UpdateRecord";
}
Any help would be appreciated :)
I'm not sure if you can do this in a callback.
But you can capture and display the error in javascript using the callbackerror function. You can set the error message to display in a div on the client side. I think obout has sample here http://www.obout.com/grid/KnowledgeBase.aspx?id=256
I'm not sure if this is exactly what you are looking for, but hope this helps.
<script type"text/javascript">
function onCallbackError(errorMessage, commandType, recordIndex, data) {
alert(errorMessage);
}
</script>
source to share