Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a partial view with another partial view. When i try to post the data from the partial view to Action method nothing happens.Even when i put a break point in the action method nothing happens .. it doesn't hit the break point. is there anything i'm doing wrong below? or could someone please direct me on how to do this?


This is the main partial view that contains another partial view
HTML
<div>
            <h2 class="heading">Thanks</h2>
            <div>
                <span>
                    <span>
                        Thank you for us
                    </span>
                </span>
            </div>
        </div>
        <div>
            @Html.Partial("_details")
        </div>
    </div>

This is the main partial view that contains another partial view:
HTML
using (Html.BeginForm("Details", "MyController", FormMethod.Post))
   {
@model DetailsModel
 @Html.CheckBoxFor(m => m.Email)
 @Html.LabelFor(m => m.Email, "I want to receive any promotions or offers via email")
 @Html.CheckBoxFor(m => m.Tel)
 @Html.LabelFor(m => m.Tel, "I want to receive any promotions or offers via sms")

 <input type="submit" value="Save" />
}


Then I have code behind like this:
C#
public ActionResult Details()
{
  return View()
}
 [HttpPost]
public ActionResult Details(DetailsModel model)
{    //post data
     return View()
}


What I have tried:

I have been researching for the past two hours.. debugging the project but still nothing . It doensnt even hit the break point.
Posted
Comments
F-ES Sitecore 11-Oct-17 10:02am    
What happens when you submit the form? Does it submit somewhere just to the wrong place? You're not nesting forms either are you, as that isn't valid.
1Future 11-Oct-17 10:07am    
Hi,
It just redirects to the parent view. thats all it does. what could i do to achieve this?
Richard Deeming 12-Oct-17 14:05pm    
Does your main view contain a form as well? You can't nest forms in HTML.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900