如何重新编写此代码以在telerik mvcextension网格中生成模板列,从cshtml到vbhtml

时间:2012-08-08 13:41:09

标签: c# asp.net-mvc vb.net telerik telerik-mvc

我从这里得到了代码。 http://demos.telerik.com/aspnet-mvc/razor/grid/templatesserverside

@model IEnumerable<Customer>
@{ Html.Telerik().Grid(Model)
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Template(
                @<text>
                    <img 
                        alt="@item.CustomerID " 
                        src="@Url.Content("~/Content/Grid/Customers/" + item.CustomerID + ".jpg") " 
                      />
                </text>
            ).Title("Picture");
            columns.Bound(c => c.ContactName).Title("Name");
            columns.Bound(c => c.Phone);
        })
        .Sortable()
        .Scrollable(scrolling => scrolling.Height(250))
        .Pageable()
        .Render();
 } 

这就是我的尝试。

 @(Html.Telerik().
Grid(Model).
Name("Grid").
DataBinding(Function(o) o.SGrid().Select("Index", "Grid")).
Columns(Sub(columns)
                columns.Bound(Function(o) o.SGrid).Width(200).Title("SGridName")
                columns.Bound(Function(o) o.SGridName).Width(100).Title("SGridName")
                columns.Bound(Function(o) o.SGrid).Width(100).Title("SGrid")
                columns.Bound(Function(o) o.SGridStopped).Width(100).Title("SGrid")
        End Sub).Pageable(Function(o) o.PageSize(3)))

我怎样才能将此写入vbhtml?

columns.Template(
                @<text>
                    <img 
                        alt="@item.CustomerID " 
                        src="@Url.Content("~/Content/Grid/Customers/" + item.CustomerID + ".jpg") " 
                      />
                </text>
            ).Title("Picture");

1 个答案:

答案 0 :(得分:0)

试试这样:

columns.Template(Sub(item)@<text><img alt="@item.CustomerID" src="@Url.Content("~/Content/Grid/Customers/" & item.CustomerID & ".jpg")" /></text>End Sub).Title("Picture")