【发布时间】:2012-04-23 14:58:49
【问题描述】:
我有 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>),
}
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-3 model-view-controller