i declare the button in .aspx its id is btn1
My prob is ,i need to assign the class name of the button and value of the button in action side(i.e in controller)
i declare the button in .aspx its id is btn1
My prob is ,i need to assign the class name of the button and value of the button in action side(i.e in controller)
Use the ViewData dictionary.
public ActionResult Show()
{
ViewData["ButtonClassName"] = "my-class-name";
ViewData["ButtonId"] = "my-id";
View();
}
And in the view:
<%= Html.SubmitButton("name", "text", new { @class = ViewData["ButtonClassName"], id = ViewData["ButtonId"] }) %>