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

VB.NET - Column HtmlAttributes NOT being applied to output

1 Answer 26 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.
Ed
Top achievements
Rank 1
Ed asked on 10 Feb 2012, 09:19 PM
Hello All,

I am experimenting with the Grid. Currently just in Server binding mode. The below renders the grid as expected. What is not expected is that I am not getting the Html Attributes rendered in the output html.

@Code       
    'declare the grid and enable features   
    Dim contactsGrid = Html.Telerik().Grid(Model.Contacts).
        Name("Contacts").
        Pageable(Function(p) p.PageSize(5)).
        Scrollable().
        Sortable()
    
    With contactsGrid
        .DataKeys(Function(key) key.Add(Function(contact) contact.ID))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.Inactive).
                     Title("Inactive").
                     Width(60)).
                 HtmlAttributes(New With {.style = "text-align:center"})
        .Columns(Function(columns) columns.Bound(Function(contact) contact.ID).
                     Title("Id").
                     Width(80))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.FirstName).Title("First Name").Width(180))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.LastName).Title("Last Name").Width(180))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.EmailAddress).Title("Email Address"))
        .Render()
    End With
End code

No matter what attributes I try to apply to that column, I do not see them in the html output (via FireBug).

Anyone have this issue or a resolution?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Ed
Top achievements
Rank 1
answered on 10 Feb 2012, 09:25 PM
Nevermind...

Turns out it was a placement issue of where I indicated .HtmlAttributes. Correct code is below for anyone else experiencing this.

@Code       
    'declare the grid and enable features   
    Dim contactsGrid = Html.Telerik().Grid(Model.Contacts).
        Name("Contacts").
        Pageable(Function(p) p.PageSize(5)).
        Scrollable().
        Sortable()
    
    With contactsGrid
        .DataKeys(Function(key) key.Add(Function(contact) contact.ID))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.Inactive).
                     HtmlAttributes(New With {.style = "text-align:center"}).
                     Title("Inactive").
                     Width(60))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.ID).
                     Title("Id").
                     Width(80))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.FirstName).Title("First Name").Width(180))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.LastName).Title("Last Name").Width(180))
        .Columns(Function(columns) columns.Bound(Function(contact) contact.EmailAddress).Title("Email Address"))
        .Render()
    End With
End code
Tags
Grid
Asked by
Ed
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
Share this question
or