我有 mvc 3 应用程序,其中我在 Index.cshtml 视图上有一个输入表单。还有一个具有编辑、删除按钮的网络网格
根据这些操作链接,我需要更改我的提交按钮文本。我怎样才能在 homecontroller.cs 中实现这一点?对所有编辑、插入仅使用一个视图。
检查 homecontroller.cs 中的用户操作
public ActionResult Index(string userAction)
{
if (userAction == "Edit" )
{
}
if (userAction == "Delete" )
{
}
}
查看代码。
<p>
<input type="submit" value="Insert" />
</p>
在具有编辑链接的 webgrid 上,在这种情况下删除我需要更改提交按钮文本。
@if (grid != null)
{
@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
columns: grid.Columns(
grid.Column("", header: null, format: @<text>@Html.ActionLink("Edit", "Index", new { uid = (int)item.id, userAction = "Edit" })
@Html.ActionLink("Delete", "Index", new { uid = (int)item.id, userAction="Delete" }, new { @class = "Delete" })</text>),
}