Page Redirection in MVC2
I am having a check box in Home Page "<%=Html.CheckBox("Sample","1")%>Sample" I am having 3 Tabs in my Application (Home,About,Product). When i check the check box,i should be redirected to the Product Page. How to 开发者_如何转开发do this.
How about his:
<% using (Html.BeginForm("Redirect", "Home", FormMethod.Post, new { id = "chksSubmit" })) %>
<%{ %>
<%: Html.CheckBox("CheckNow", new { onclick = "javascript:document.getElementById('chksSubmit').submit();" })%>
<% }%>
In the controller:
public ActionResult Redirect()
{
return RedirectToAction("Home");
}
You could try
<%=Html.CheckBox("Sample","1", new {onclick="location='"+Url.Action("Product")+"'")%>
精彩评论