This is a migrated thread and some comments may be shown as answers.
Kendo HTML Helper with VB in Razor/Webforms
3 Answers 80 Views
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 2
Nathan asked on 16 Sep 2012, 05:39 PM
I've look everywhere but all the code/examples I can find for Kendo UI MVC helper appear to be in C#.

Can someone point me at the VB samples or confirm Kendo only works with C#.

3 Answers, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 24 Sep 2012, 03:00 AM
They write the samples in C#, because it is more popular, but VB.Net is also a .Net language, so it should be able to do most everything C# can do.  If you have a specific example I might be able to help translating it for you.

Wade
0
Eugene
Top achievements
Rank 1
answered on 28 Apr 2014, 09:21 AM
Hello William!

Please help with these line of code (bold text) from C# to VB.NET.(I use this: Model(Function(m) m.Id(Function(c) c.ProductID))), but it not work.


@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice).Width(100);
columns.Bound(p => p.UnitsInStock).Width(100);
columns.Bound(p => p.Discontinued).Width(100);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.ProductID))
.Create(update => update.Action("EditingInline_Create", "Grid"))
.Read(read => read.Action("EditingInline_Read", "Grid"))
.Update(update => update.Action("EditingInline_Update", "Grid"))
.Destroy(update => update.Action("EditingInline_Destroy", "Grid"))




0
Dimo
Telerik team
answered on 28 Apr 2014, 02:24 PM
Hi Eugene,

The correct syntax is provided at

http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/vb#grid


.Model(Sub(m)
             m.Id(Function(c) c.ProductID)
       End Sub)

or

.Model(Sub(m)
          m.Id("ProductID")
     End Sub)


It is also possible to use more concise syntax


.Model(Sub(m) m.Id(Function(c) c.ProductID))

or

.Model(Sub(m) m.Id("ProductID"))


Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Asked by
Nathan
Top achievements
Rank 2
Answers by
William
Top achievements
Rank 1
Eugene
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or