This is a migrated thread and some comments may be shown as answers.

[Solved] Problem with grid, razor and VB.NET in Ajax binding mode

3 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Beni
Top achievements
Rank 1
Beni asked on 19 Dec 2011, 07:09 PM

 

 

Hi.

I'm trying to create a Grid in MVC3 with razor and VB.NET. The normal Grid works fine, sorts and paginates fine (but it doesn't show filter options and it doesn't show the arrows to paginate when displaying the items, what do I need?), but when I try to make the Ajax binding, I get an error 500 - internal server error when I try to paginate.  

What am I doing wrong?

This is my controller:

 

 

Function Index() As ViewResult
    Return View(Me.orgRepository.GetOrgs())   
End Function

<GridAction()>
Function AjaxGrid() As ActionResult 
    Return View(New GridModel(Of hdmtORG)() With 

        {

            .Data = Me.orgRepository.GetOrgs()

        })

End Function


 

 

This is my View:

 

@Code
'declare the grid and enable features   
Dim grid = Html.Telerik().Grid(Model) _
    .Name("Grid") _  
    .Pageable() _
    .Sortable() _   
    .Filterable() _
    .DataBinding(Function(dataBinding) dataBinding.Ajax.Select("AjaxGrid", "Org"))   
    'Add grid columns
    grid.Columns(Function(columns) columns.Bound(Function(o) o.orgNAME).Width(200))   
    grid.Columns(Function(columns) columns.Bound(Function(o) o.orgIMAGE).Width(200))
    grid.Columns(Function(columns) columns.Bound(Function(o) o.orgUNIT).Width(200))
  
    'Render the grid   
    grid.Render()
End code

Thank you for your help.

3 Answers, 1 is accepted

Sort by
0
Ed
Top achievements
Rank 1
answered on 09 Feb 2012, 10:45 PM
Did you ever get an answer from Telerik on this?
0
Beni
Top achievements
Rank 1
answered on 09 Feb 2012, 11:21 PM
Hi Ed.

No, I had no answer, but I figured out how to fix it with this:

http://blogs.telerik.com/aspnetmvcteam/posts/10-01-25/resolving-circular-references-when-binding-the-mvc-grid.aspx 

I hope it helps.
0
Ed
Top achievements
Rank 1
answered on 10 Feb 2012, 04:16 PM
Thanks Beni!!
Tags
Grid
Asked by
Beni
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
Beni
Top achievements
Rank 1
Share this question
or