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

[Solved] RowTemplate in Razor/VB Please

2 Answers 119 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.
Rhek
Top achievements
Rank 1
Rhek asked on 27 Jul 2011, 07:07 AM
My converting from C# to VB has been going pretty good today, but I am stuck on the following code from your "Server Row Template" example, http://demos.telerik.com/aspnet-mvc/razor/grid/serverrowtemplate.

Mainly, I am not sure what to do with ".RowTemplate(grid => @text".  If there is any other gotcha's in the code please also let me know.

Thanks!

.RowTemplate(grid => @<text>
  <div class="employee-details">
    <img src='@Url.Content("~/Content/Grid/Customers/" + item.CustomerID + ".jpg")' alt='@item.ContactName' />
    <h3 class="t-widget">@item.ContactName</h3>
    <dl>
      <dt>Name:</dt><dd>@item.ContactName</dd>
      <dt>Company:</dt><dd>@item.CompanyName</dd>
      <dt>Country:</dt><dd>@item.Country</dd>
    </dl>
    <dl class="t-widget">
      <dt>Address:</dt><dd>@item.Address</dd>                  
      <dt>Phone:</dt><dd>@item.Phone</dd>               
    </dl>
    <div class="commands">
      @grid.EditButton(item)
      @grid.DeleteButton(item)
    </div>
  </div>
</text>)


2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 27 Jul 2011, 10:29 AM
Hi Rhek,

Here is the grid declaration from the example converted to VB:

@modelType IEnumerable(Of Customer)
@Code
Html.Telerik().Grid(Model) _
    .Name("Grid") _
    .DataKeys(Function(key) key.Add(Function(c) c.CustomerID)) _
    .Columns(Sub(columns)
                     columns.Bound(Function(c) c.CustomerID).Title("Picture")
                     columns.Bound(Function(c) c.ContactName).Title("Name")
             End Sub) _
    .RowTemplate(Sub(item, grid)
                                     @<text>
                                      
            <img src='@Url.Content("~/Content/Grid/Customers/" & item.CustomerID & ".jpg")'
                    alt='@item.ContactName' />
                <h3 class="t-widget">@item.ContactName</h3>
                <dl>
                   <dt>Name:</dt><dd>@item.ContactName</dd>
                   <dt>Company:</dt><dd>@item.CompanyName</dd>
                   <dt>Country:</dt><dd>@item.Country</dd>
                </dl>
                <dl class="t-widget">
                   <dt>Address:</dt><dd>@item.Address</dd>
                   <dt>Phone:</dt><dd>@item.Phone</dd>
                </dl>
                <div class="commands">
                     @grid.EditButton(item)
                     @grid.DeleteButton(item)
                </div>
           </text>
                 End Sub) _
    .Editable(Function(editable) editable.Mode(GridEditMode.PopUp)) _
    .DataBinding(Function(dataBinding) dataBinding.Server() _
                                       .Update("ServerRowTemplate_Update", "Home") _
                                       .Delete("ServerRowTemplate_Delete", "Home")) _
    .Sortable() _
    .Pageable() _
    .Render()
End Code

Greetings,
Rosen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

0
Rhek
Top achievements
Rank 1
answered on 28 Jul 2011, 01:59 AM
Thanks! Very much appreciated!
Tags
Grid
Asked by
Rhek
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Rhek
Top achievements
Rank 1
Share this question
or