asp.net MVC Webgrid操作列不起作用

时间:2018-11-06 05:12:30

标签: asp.net-mvc webgrid

我想在我的网络网格中以及一栏中同时具有两个删除和编辑َ动作按钮。但是有一个问题,帮我,哪里出问题?!

@ModelType IEnumerable(Of Machinary.Brand)
@Code
    Dim wg As New WebGrid(Model, rowsPerPage:=10, canPage:=True, canSort:=True, ajaxUpdateContainerId:="wg1")
    Dim rowIndex = ((wg.PageIndex + 1) * wg.RowsPerPage) - (wg.RowsPerPage - 1)
End Code
<section Class="panel">
    <br />
    <header Class="panel-heading">Brands</header>
   
    <div Class="panel-body pull-left">
        @Using (Html.BeginForm("BrandList", "Home", FormMethod.Get))
            @Html.TextBox("strName", Nothing, New With {.class = "form-control", .PlaceHolder = "جستجو"})
                @<Button type="submit" value="" style="display: none"></Button>
        End Using

    </div>
  
    <div>
        
        @wg.GetHtml(tableStyle:="table table-bordered table-hovor", mode:=WebGridPagerModes.All,
                          htmlAttributes:=New With {.id = "wg1", .class = "Grid"},
                          firstText:="<<",
                          lastText:=">>",
                          footerStyle:="table-pager",
                          columns:=
                          wg.Columns(wg.Column("Name", "Title"),
                          wg.Column(header:="Actions", format:=Function(item) New HtmlString() {
                          Html.ActionLink("Edit", "Edit", New With {.id = item.id}),
                          Html.ActionLink("Delete", "Delete", New With {.id = item.id})})))
    </div>
</section>

This image shows the code output

1 个答案:

答案 0 :(得分:0)

问题解决了。修改后的代码如下

  @wg.GetHtml(tableStyle:="table table-bordered table-hovor", mode:=WebGridPagerModes.All,
                                               htmlAttributes:=New With {.id = "wg1", .class = "Grid"},
                                               firstText:="<<",
                                               lastText:=">>",
                                               footerStyle:="table-pager",
                                               columns:=
                                               wg.Columns(wg.Column("Name", "Title"),
                                               wg.Column(header:="Actions", format:=Function(item) New HtmlString(
                                               Html.ActionLink("Edit", "Edit", New With {.id = item.id}).ToString +
                                               Html.ActionLink("Delete", "Delete", New With {.id = item.id}).ToString))))
相关问题