0

我从这里得到了代码。 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");
4

1 回答 1

0

试试这样:

columns.Template(Sub(item)@<text><img alt="@item.CustomerID" src="@Url.Content("~/Content/Grid/Customers/" & item.CustomerID & ".jpg")" /></text>End Sub).Title("Picture")
于 2012-08-08T15:52:31.703 回答