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

[Solved] MVC Grid issues

4 Answers 114 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.
Natalie
Top achievements
Rank 1
Natalie asked on 24 Jan 2011, 09:10 PM
Hello,

I'm having major issues using the MVC Grid control. Our data comes from an XML stream, and we're serializing it into a class, into properties. Part of this data needs to be displayed in a grid so we can add/edit/delete rows. The problem is that I can't see any way to get the data from my class's properties into the grid. Can anyone give me an example (in VB.NET please) on how to get the data from a partial class into the MVC Grid?  I've looked at all the samples and none of them use a class as the data source. Is this even possible? It should be; the main part of our data is just being displayed in text boxes and that works fine, but for the data we're dealing with (rows of details within the main record), I can't figure it out. I have no code snippets to post because I can't even get the sample MVC Grid code to run without crashing in my project.

TIA,
Nat

4 Answers, 1 is accepted

Sort by
0
Andrew
Top achievements
Rank 1
answered on 24 Jan 2011, 09:40 PM
Without knowing your class structure its difficult to answer, but if you can query your classes with LINQ then you should be able to use the grid pretty easily. If you can't query with LINQ then I wouldn't know where to start!
0
Natalie
Top achievements
Rank 1
answered on 25 Jan 2011, 01:10 AM
Thanks; I'll give that a try tomorrow!
0
Natalie
Top achievements
Rank 1
answered on 25 Jan 2011, 07:24 PM

OK, so now I think I'm partially there. Now I just get an error. I think it's because the translator from C# to VB.NET missed something. Here's my code:

Dim studentlist = GetStudents()
    Html.Telerik.Grid(Of StudentListStudent).Name("Grid").PrefixUrlParameters(False).Columns(Function(columns) Do _
    columns.Bound(Function(o) o.IRS).Width(60) _
    columns.Bound(Function(o) o.FamilyName).Width(100) _
    columns.Bound(Function(o) o.FirstName).Width(100) _
End Function)

The error I get when I run this is: Compilation Error: BC30201: Expression expected. I'm not up to speed with VB.NET, so any help would be appreciated.

Thanks!
0
Natalie
Top achievements
Rank 1
answered on 25 Jan 2011, 07:47 PM
OK, I fixed that issue; now I'm just not getting any data displaying in the grid. I think it's my list that's not getting populated.
Tags
Grid
Asked by
Natalie
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
Natalie
Top achievements
Rank 1
Share this question
or