I have mvc 3 application in which i’m having one input form on Index.cshtml view. also having one webgrid which is having edit,delete button
depending upon these action links i need to change my submit button text. how can i achieve this inside homecontroller.cs ? using only one view for all edit,insert.
checking useraction inside homecontroller.cs
public ActionResult Index(string userAction)
{
if (userAction == "Edit" )
{
}
if (userAction == "Delete" )
{
}
}
View code.
<p>
<input type="submit" value="Insert" />
</p>
On webgrid having link for edit , delete
on that condition i need to change submit button text.
@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>),
}
You can store the
userActioninViewDataorViewBagand access it from the View.