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

[Solved] MVC 3 Razor Visual Basic Grid

7 Answers 254 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Casey
Top achievements
Rank 1
Casey asked on 23 Jun 2011, 04:01 PM
I'm trying to implement the Telerik grid into my MVC3 VB project. I'm using LINQ to SQL for my data.
Here's what I have so far:

I'm new to MVC so I'm not positive what else is needed can we walk through this to provide an example for the forums, Thanks
@(Html.Telerik().Grid(Of "ProjectName.LINQTOSQL File")(Model) _
    .Name("grid") _
    .Pageable() _
    .Sortable() _
    .Columns(Function(columns) columns.Bound(Function(model) model."TableName").Title("Column1")) _
    .Columns(Function(columns) columns.Bound(Function(model) model."TableName").Title("Column2"))
     
    Dim commandcolumn As New GridActionColumn(Of "ProjectName.LINQTOSQL File")(Grid.ToComponent())
    commandcolumn.Commands.Add(New GridEditActionCommand(Of "ProjectName.LINQTOSQL File"))
    commandcolumn.Commands.Add(New GridDeleteActionCommand(Of "ProjectName.LINQTOSQL File"))
    Grid.ToComponent().columns.add(commandcolumn)
    Grid.render()
     
)  

7 Answers, 1 is accepted

Sort by
0
Demon
Top achievements
Rank 1
answered on 24 Jun 2011, 06:26 AM
0
Casey
Top achievements
Rank 1
answered on 27 Jun 2011, 03:26 PM
Can you convert this into vb.net please, Thanks

@model IEnumerable<Order>
@(Html.Telerik().Grid(Model)
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.OrderID).Width(100);
            columns.Bound(o => o.Customer.ContactName).Width(200);
            columns.Bound(o => o.ShipAddress);
            columns.Bound(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(120);
        })
        .Groupable()
        .Sortable()
        .Pageable()
        .Filterable()
)
0
Casey
Top achievements
Rank 1
answered on 06 Jul 2011, 04:08 PM
I'm getting this error can you help clear up why?


0
lbartroli
Top achievements
Rank 1
answered on 11 Jul 2011, 03:01 PM
This is de VB code...
@modeltype 
IEnumerable(Of 
Order)
@(
Html.Telerik().     Grid(Model).     Name("Grid").     Columns(Sub(columns)                     columns.Bound(Function(o) o.OrderID).Width(100)                     columns.Bound(Function(o) o.Customer.ContactName).Width(200)                     columns.Bound(Function(o) o.ShipAddress)                     columns.Bound(Function(o) o.OrderDate).Width(120)             End Sub).     Groupable().     Sortable().     Pageable().     Filterable() )
0
Pradeep
Top achievements
Rank 1
answered on 21 Jul 2011, 05:24 AM
Hi
I am new to mvc and facing lot of issues of this type of thread. Please can u send me entire solution using VB.net
It is must required to me, its developing in my current project.
0
Ed
Top achievements
Rank 1
answered on 10 Feb 2012, 05:27 PM
I know this is an old thread, but here is VB code that actually compiles and works. Just replace my model with your model and update the column properties.


@ModelType ContactCollectionModel

@Code       
    'declare the grid and enable features   
    Dim contactsGrid = Html.Telerik().Grid(Model.Contacts).
        Name("Contacts").
        Pageable(Function(p) p.PageSize(10).PageSize(5)).
        Sortable()
    
    With contactsGrid
        .DataKeys(Function(key) key.Add(Function(contact) contact.ID))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.ID).Title("Id"))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.FirstName).Title("First Name"))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.LastName).Title("Last Name"))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.EmailAddress).Title("Email Address"))
        .Render()
    End With
End code
Enjoy!!
0
Duna
Top achievements
Rank 1
answered on 21 Feb 2012, 04:43 PM
Can i have the entire project sollution as zip file with grid  razor and vb? thanks
Tags
General Discussions
Asked by
Casey
Top achievements
Rank 1
Answers by
Demon
Top achievements
Rank 1
Casey
Top achievements
Rank 1
lbartroli
Top achievements
Rank 1
Pradeep
Top achievements
Rank 1
Ed
Top achievements
Rank 1
Duna
Top achievements
Rank 1
Share this question
or