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);
}
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);
}
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.