Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript jQuery MVC3
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
 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 20-Jul-12 0:38am
Edited 20-Jul-12 0:45am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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:
alert('Error: ' + e.Message.Message + ' ('+ e.Message.MessageCode +')');
Good luck!
  Permalink  
Comments
kulasekaran-M at 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 at 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 +')');
kulasekaran-M at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 410
1 Maciej Los 258
2 CHill60 222
3 OriginalGriff 210
4 Sinisa Hajnal 125


Advertise | Privacy | Mobile
Web03 | 2.8.141022.2 | Last Updated 20 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100