-1

I'm working with Telerik Grid using databinding Ajax and MVC 3. The first problem I have is When I am going to Load data in Grid , the data loaded successfully. but Some times Its showing the pop up with error meassage "Error! The requested URL returned 500 - Internal Server Error". The second is when I try to filter a value in grid , I am getting the same exception But not in all times.

Can anyone tell me, Why this Error is occuring Some of the times? And How can I solve this problem And How can I stop the error popup showing? Please giude me on this. Thanks.

This is My View code:

@(
Html.Telerik().Grid<ItemValueView>()
           .Name("ItemGrid")
           .Scrollable(scrollable => scrollable.Height("550px"))
           .ClientEvents(events => events
                                       .OnLoad("onLoad")                                                                                      .OnDataBound("onDataBound")
                                       .OnEdit("onEdit")
                                       //.OnSave("onSave")
           )
           .Editable(editing => editing.Mode(GridEditMode.InLine))
           .DataKeys(dataKeys => dataKeys.Add(i => i.ItemKey))
           .DataBinding(dataBinding => dataBinding
                                           //Ajax binding
                                           .Ajax()
                                           .OperationMode(GridOperationMode.Server)
                                           .Select("AjaxToolSelect", "SalesTool")

                                                                                         .Update("AjaxToolUpdate", "SalesTool")
           )

           .Columns(columns =>
                        {
                            columns.Bound(i => i.CustomerName).Title("Customer").ReadOnly();
                            columns.Bound(i => i.DisplayClassKey).Title("Sub Class").ReadOnly();
                            columns.Bound(i => i.Place).Visible(false);
}) 
                                    .Pageable(pager => pager.PageSize(50))
                                    .Sortable(sorting => sorting
                                    .SortMode(GridSortMode.MultipleColumn)
                                    .OrderBy(sortOrder =>
                                                 {
                                                     sortOrder.Add(i => i.CustomerName);
                                                     sortOrder.Add(i => i.DisplayClassKey);

                                                 }))
           .Groupable(grouping => grouping
                                      .Groups(groups => groups.Add(g => g.CustomerName))
           )
           .Filterable()

My Controller is:

    [HttpPost]
    [GridAction]
    public ActionResult AjaxToolSelect()
    {
        var items = DataProvider.GetAllItems(true);
        var grid = new GridModel(items);
        return View(grid);
    }
5
  • 1
    Relevant code please? :)
    – Kjartan
    Sep 10, 2012 at 9:25
  • 1
    There are about 2^156 reasons why you might get a 500 error in a web application. Do you want me to enumerate them in an answer or you might for example show your code which would greatly narrow down this number? Sep 10, 2012 at 9:27
  • 1
    Most likely something is breaking on your controller method. Put a breakpoint down and step through your code.
    – tobias86
    Sep 10, 2012 at 9:58
  • I know this isn't helpful but the only time i get 500 error is when asp didnt like some of the characters in the url. Also sometimes when i POST data that looks like a sql injection
    – user34537
    Sep 10, 2012 at 9:59
  • Can any one know How to Hide the reference properties to avoid the circular reference problem in my case? Sep 10, 2012 at 10:15

1 Answer 1

2

500 Internal Server Error is a very generic error. 500 means something went wrong on the server (in this case most likely in the C# code or the view). It doesn't really tell us anything about what went wrong.

To track down the error, there are a few things you can try. If you're running in visual studio, check the output log and see if there are any error messages there. Try setting break points in C# and see what code actually gets executed. If you go to the developer tools in your web-browser, you could find the actual web-request that returns 500 as its status code. as it may have some additional info for you. In Google Chrome you'd do this by pressing F12, going to the network tab, selecting the request and then looking at the preview or response tabs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.