RobinHood
RobinHood

Reputation: 2397

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.

Upvotes: 1

Views: 1153

Answers (2)

msuhash
msuhash

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

David Christiansen
David Christiansen

Reputation: 5899

You could try

<%=Html.CheckBox("Sample","1", new {onclick="location='"+Url.Action("Product")+"'")%>

Upvotes: 1

Related Questions