Display patial from different controller and post back to controller

2 posts, 1 answers
  1. Kahl
    Kahl avatar
    15 posts
    Member since:
    Nov 2016

    Posted 23 Mar Link to this post

    I have tabstrip that is displaying a partial from a different controller/view area, but I cant get the post of the partial in the tabstrip to post back to the different controller

     

    the View that the tab is in.

    ~/Areas/Secure/Views/Company/companyStaff.cshtml

    display a view assocated to a different controller

    tabstrip.Add().Text("Create Contact")
                      .Selected(false)
                      .Content(Html.Partial("~/Areas/Secure/Views/Contact/_ContactManagement.cshtml",  new WebSite.Library.Models.Contact() , new ViewDataDictionary { { "Id", "0" } }).ToHtmlString());

     

    How can I get the partial in the tab to post back to its own controller post method

  2. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    1332 posts

    Posted 27 Mar Link to this post

    Hello Kahl,

    I tested the described scenario and at my end the form in a partial view loaded in a TabStrip tab was posted to the specified controller:

    Partial View:
    @using (Html.BeginForm("MyAction", "Default1", FormMethod.Post))
    {

    Controller:
    [HttpPost]
    public ActionResult MyAction()
    {

    Do you have the HttpPost attribute set to your action?

    Regards,
    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top