asp.net MVC Webgrid 操作列不工作
asp.net MVC Webgrid Action Column not working
我想在我的 webgrid 中同时在一列中有两个 delete 和 edit óAction Buttons。但是有一个问题,帮帮我,问题出在哪里?
@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
问题已解决。修改后的代码如下
@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))))
我想在我的 webgrid 中同时在一列中有两个 delete 和 edit óAction Buttons。但是有一个问题,帮帮我,问题出在哪里?
@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
问题已解决。修改后的代码如下
@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))))