Error in vb.net html helper grid

2 posts, 0 answers
  1. Tabatha
    Tabatha avatar
    11 posts
    Member since:
    Mar 2017

    Posted 16 May Link to this post

    I think I just need another set of eyes on this.  I had to translate a Kendo UI Html Helper Grid from C# into VB.  This is what I have:

     

    @(Html.Kendo().Grid(Of CustomerJob)() _
                        .Name("customerJobGrid") _
                        .DataSource(Function(x) x.Ajax() _
                            x.Sort(Function(s) s.Add("JobNo").Descending()) _
                            x.Read(Function(read) read.Action("Jobs_Active_Read", "DashBoard")) _
                            x.Model(Sub(m) m.Id(Function(i) i.JobNo))) _
                        .Columns(Sub(c) c.Bound(Function(p) p.CustomerName).Title("Account") _
                            c.Bound(Function(p) p.Nickname).Title("Name") _
                            c.Bound(Function(p) p.JobNo).Title("Job ID").Width(90).MinScreenWidth(768) _
                            c.Bound(Function(p) p.SiteAddress).Title("Street").MinScreenWidth(768) _
                            c.Bound(Function(p) p.SiteCity).Title("City").MinScreenWidth(768)) _                        
                        .Pageable() _
                        .Sortable() _
                        .Scrollable() _
                        .Filterable(Function(f) f.Extra(True) _
                            f.Operators(Function(o) o.ForString(Function(s) s.Clear() _
                                s.Contains("Contains") _
                                s.DoesNotContain("Does not contain") _
                                s.IsEqualTo("Is equal to") _
                                s.IsNotEqualTo("Is not equal to") _
                                s.StartsWith("Starts with") _
                                s.EndsWith("Ends with") _
                                s.IsEmpty("Is empty") _
                                s.IsNotEmpty("Is not empty") _
                                s.IsNull("Is null") _
                                s.IsNotNull("Is not null ")))) _
                        .Mobile(MobileMode.Disabled) _
                        .Selectable(Function(selectable) selectable.Mode(GridSelectionMode.Single) _
                            selectable.Type(GridSelectionType.Row)) _
                        .Events(Function(events) events.Change("onChange")) _
                        .HtmlAttributes(New With {Style = "height:400px;"}) _
                        .Render()
                    )

     

    At "x.Sort(Function(s)", visual studio is giving me this error:  "Comma, ')', or a valid expression continuation expected."

    I checked that I have the same total number of '(' and ')'.  I have no idea why it is telling me this and why there.

     

  2. Stefan
    Admin
    Stefan avatar
    1025 posts

    Posted 18 May Link to this post

    Hello Tabatha,

    I noticed a few differences in the provided code snippet compare to our article for the VB syntax and the Grid:

    http://docs.telerik.com/aspnet-mvc/getting-started/vb#grid

    For example noticed that only the Ajax() method is using the x parameter from the function.

    Also, the column should finish with:

    End Sub) _

    If the issue still occurs after the modifications, please send a fully runnable example and I will gladly assist.

    Regards,
    Stefan
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top