[CLOSED] PartialViewResult with FormPanel does not show in FormCollection-Part 2

  1. #1

    [CLOSED] PartialViewResult with FormPanel does not show in FormCollection-Part 2

    In my question posted on June 25th - I instituted the solution of adding RenderMode = RenderMode.AddTo when generating a PartialViewResult and everything thing was working perfectly -
    Except the speed of the display of the PartialViewResult.
    I modified my code to execute a ContentFromPartial instead of using a loader.
    Displays instantly - but I'm back to my first problem. The elements of the partial view do not show up in the formcollection on submit.
    (I'm guessing there is a way of specifying RenderMode = RenderMode.AddTo on the ContentFromPartial..but nothing I have tried works!)
    Thanks!!!
    Cyndi Pruett

    The supporting class
     public class Company
        {
            public int ID { get; set; }
            public string strID { get; set; }
            public string company { get; set; }
            public string company_inPartialView { get; set; }
            public string PartialViewName { get; set; }
    }
    the controller
    public ActionResult Edit_Partial()
            {
                Company c = new Company();
                c.strID = "1";
                c.company = "test";
                c.company_inPartialView = "test_inPartialView";
                c.PartialViewName = "PartialView";
               return  View(c);
            }
            public ActionResult Save_Partial(FormCollection collection)
            {
                Company c = new Company();
                c.PartialViewName = collection["PartialViewName"];
              
                c.strID = collection["strID"];
                c.company = collection["company"];
                c.company_inPartialView = collection["company_inPartialView"];
                return View("Edit_Partial", c);
            }
            public Ext.Net.MVC.PartialViewResult PartialView(string containerId)
            {
                Company c = new Company();
                c.strID = "1";
                c.company = "test";
                c.company_inPartialView = "test_inPartialView";
                c.PartialViewName = "PartialView";
                return new Ext.Net.MVC.PartialViewResult
                {
                    ContainerId = containerId,
                    ViewName = c.PartialViewName,
                    WrapByScriptTag = false,
                    Model = c,
                    RenderMode = RenderMode.AddTo
                };
            }
    the view
    @model tracker.Controllers.Company
    @{
        ViewBag.Title = "Edit_Partial";
        Layout = "~/Views/Shared/_BaseLayout_orig.cshtml";
    }
    
    <h2>Edit_Partial</h2>
    @section _body
    {
         @(Html.X().FormPanel() .ID("fp") .StandardSubmit(true).Width(1400).BodyPadding(5)
            .TopBar(Html.X().Toolbar()
                            .Items(Html.X().Button().Text("Save").IconUrl("~/images/save.png").IconCls("x-btn-text-icon")
                            .DirectEvents(de =>
                                            {
                                                de.Click.Url = Url.Action("Save_Partial");
                                                de.Click.EventMask.ShowMask = true;
                                                de.Click.FormID = "fp";
                                            })
                                  )
                     )
            .Items(
                        Html.X().Panel().ID("Panel1").ColSpan(1).Title("").Height(100).Width(400).MarginSpec("5 5 5 5")
                                                .Items(Html.X().TextField().Name("strID").FieldLabel("strID").Value(Model.strID)
                                                ),
                        Html.X().Panel().ID("Panel2").ColSpan(1).Title("").Height(100).Width(400).MarginSpec("5 5 5 5")
                                        .Items( Html.X().TextField().Name("PartialViewName").ID("PartialViewName").FieldLabel("PartialViewName").Value(Model.PartialViewName).Hidden(true),
    Html.X().TextField().Name("company").ID("company").FieldLabel("company").Value(Model.company),
                                                        //Html.X().Container().ID("cPartialView").Loader(Html.X().ComponentLoader().Url(Url.Action("PartialView")).Mode(LoadMode.Script) .Params(new { containerId = "cPartialView" })),
    Html.X().Container().ID("cPartialView").ContentFromPartial(Model.PartialViewName, Model ).RenderTo("Panel2")
    
                                               )
                                   )
                   )
    }
    The PartialView
    @using Ext.Net;
    @using Ext.Net.MVC;
    
    @model tracker.Controllers.Company
    
    @Html.X().TextField().Name("company_inPartialView").ID("company_inPartialView").FieldLabel("company_inPartialView").Width(390).Value(Model.company_inPartialView)
    Last edited by Daniil; Jul 23, 2014 at 1:00 PM. Reason: [CLOSED]
  2. #2
    Hi @cynsystems,

    Please try ItemsFromPartial (it is rendered as Items) instead of ContentFromPartial (it is rendered as raw HTML).

    In my question posted on June 25th
    Posting links in such cases might be useful.

Similar Threads

  1. [CLOSED] PartialViewResult with FormPanel does not show in FormCollection
    By cynsystems in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 26, 2014, 5:03 PM
  2. Replies: 2
    Last Post: Jul 12, 2012, 2:06 PM
  3. Replies: 5
    Last Post: Jul 26, 2011, 12:17 PM
  4. [CLOSED] Layout School Part III: Why doesnt the UserControl show up
    By wagger in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: May 20, 2011, 8:10 AM
  5. FormCollection values not being posted
    By GLD in forum 1.x Help
    Replies: 8
    Last Post: Apr 21, 2011, 11:02 PM

Posting Permissions