Click here to Skip to main content
15,904,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all
I am doing batch editing in telerik mvc3.By clicking savechanges button in the grid it updates the database for this am using ajax options.if any error occurred while saving records an exception message is throwing but I want to display that exception message in my view page i tried this coding but not working properly
JavaScript
function OnSuccess( e ) {
      var container =  $(".msg_container");
       if(e.HasError==false)
           {
                var grid = $("#grdHolidays").data("tGrid");
                grid.rebind();
                alert("Saved");
           }
        else
           {
                showMessage(e.Message.MessageCode, e.Message.Message,                   e.Message.MessageType ,container);
                 alert("Error occurred");
           }
   }

I had called this function on OnSuccess event.Alert message "Error occurred" is coming but show message is not working. that MessageCode,message and messsagetype are having values also
Posted
Updated 20-Jul-12 0:45am
v3

1 solution

If you look at the code markup applied in your code above you'll see that the it doesn't know what to do with it. Try an alert:
JavaScript
alert('Error: ' + e.Message.Message + ' ('+ e.Message.MessageCode +')');

Good luck!
 
Share this answer
 
Comments
kevin_ze 20-Jul-12 8:20am    
Thank you its working.if any possibilities is there to display the same in a <div> in my view page
E.F. Nijboer 20-Jul-12 8:45am    
Sure, just update or append it to that div, something like:
$('#div_id').append('Error: ' + e.Message.Message + ' ('+ e.Message.MessageCode +')');
kevin_ze 20-Jul-12 9:24am    
Thanks a lot its working..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900