Reputation: 2397
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.
Upvotes: 1
Views: 1153
Reputation: 266
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");
}
Upvotes: 1
Reputation: 5899
You could try
<%=Html.CheckBox("Sample","1", new {onclick="location='"+Url.Action("Product")+"'")%>
Upvotes: 1