[CLOSED] Partial view load issue on first click of submit button

  1. #1

    [CLOSED] Partial view load issue on first click of submit button

    Hi,

    I am Loading a partial view using ComponentLoader() which contains Tab panel, In Partial view there are two more partial views for each tab.
    For Ex: Main container --> TabPanel PartialView --> Tab1 PartialView & Tab2 PartialView
    Initially Main Container is hidden and i am showing the main container on Submit button.
    The issue is On first click of submit button, main container is not loading the partial views but after second click of submit button, it is working fine.
    Here is my code

    // Main View
    
    <script>
        var btnSubmit_Click = function () {
            var mainContainer = Ext.getCmp("MainContainer");
            mainContainer .loader.paramsFn = getParammeters;
            mainContainer .show();
            mainContainer .reload();
          };
    
    
    </script>
    
    
    @(
          Html.X().Container()
                  .ID("MainContainer")
                  .Hidden(true)
                  .Padding(5)
                  .Border(true)
                  .Loader(
                            Html.X().ComponentLoader().LoadMask(x => x.ShowMask = true)
                            .Url(Url.Action("LoadTabularPartialView"))
                            .AutoLoad(false).Mode(LoadMode.Script)
                            .Params(new { containerId = "MainContainer" })
                          )
    )
      @(Html.X().Button().Text("Show Graph").Width(60).ID("btnSubmit").Handler("btnSubmit_Click"))
    // TabPanel Partail View
    @(Html.X().TabPanel()
                .ID("GraphTab")
                .ActiveTabIndex(0)
                .MinHeight(450)
                .Plain(true)
                .Margin(0)
                .Items
                 (
                        Html.X().Panel()
                            .Margin(0).Padding(5)
                            .Title("Cumulative")
                            .ID("Panel1")
                            .Items(Html.X().Container()
                                       .ID("CumulativeContainer")
                                       .DefaultAnchor("100%")
                                       .Loader(Html.X().ComponentLoader().LoadMask(x=>x.ShowMask = true)
                                                   .Url(Url.Action("LoadCumulativePartialView"))
                                                   .AutoLoad(true).Mode(LoadMode.Script)
                                                   .Params(new { containerId = "CumulativeContainer", scId=Model.Id})
                                              )
                            ),
    
    
                        Html.X().Panel()
                            .Margin(0).Padding(5)
                            .Title("Monthly")
                            .ID("Panel2")
                            .Items(Html.X().Container()
                                       .ID("MonthlyContainer")
                                       .DefaultAnchor("100%")
                                       .Loader(
                                                Html.X().ComponentLoader().LoadMask(x=>x.ShowMask = true)
                                                    .Url(Url.Action("LoadMonthlyPartialView"))
                                                    .AutoLoad(true).Mode(LoadMode.Script)
                                                    .Params(new { containerId = "MonthlyContainer", scId=Model.Id })
                                              )
    
    
                                  )
                )//Tab Panel
         
         )
    //Tab1 Partial View
    @(Html.X().Container().Border(false)
          .ID("Container1")
          .Height(400)
          .Layout(LayoutType.Fit)
          .Control(item => this.Initchartcumulative(item))
    )
    
    //Tab2 Partial View
    @(Html.X().Container().Border(false)
          .ID("Container2")
          .Height(400)
          .Layout(LayoutType.Fit)
          .Control(item => this.Initchartmonthly(item))
    )
    Thanks
    Last edited by Daniil; Sep 10, 2013 at 5:27 AM. Reason: [CLOSED]
  2. #2
    Hi @PriceRightHTML5team,

    Please post controller actions as well.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @PriceRightHTML5team,

    Please post controller actions as well.
    Here is my code with controller action:

    // Main View
    
    <script>
        var btnSubmit_Click = function () {
            var mainContainer = Ext.getCmp("MainContainer");
            mainContainer .loader.paramsFn = getParammeters;
            mainContainer .show();
            mainContainer .reload();
          };
    
    
    </script>
    
    
    @(
          Html.X().Container()
                  .ID("MainContainer")
                  .Hidden(true)
                  .Padding(5)
                  .Border(true)
                  .Loader(
                            Html.X().ComponentLoader().LoadMask(x => x.ShowMask = true)
                            .Url(Url.Action("LoadTabularPartialView"))
                            .AutoLoad(false).Mode(LoadMode.Script)
                            .Params(new { containerId = "MainContainer" })
                          )
    )
      @(Html.X().Button().Text("Show Graph").Width(60).ID("btnSubmit").Handler("btnSubmit_Click"))
    // TabPanel Partail View
    @(Html.X().TabPanel()
                .ID("GraphTab")
                .ActiveTabIndex(0)
                .MinHeight(450)
                .Plain(true)
                .Margin(0)
                .Items
                 (
                        Html.X().Panel()
                            .Margin(0).Padding(5)
                            .Title("Cumulative")
                            .ID("Panel1")
                            .Items(Html.X().Container()
                                       .ID("CumulativeContainer")
                                       .DefaultAnchor("100%")
                                       .Loader(Html.X().ComponentLoader().LoadMask(x=>x.ShowMask = true)
                                                   .Url(Url.Action("LoadCumulativePartialView"))
                                                   .AutoLoad(true).Mode(LoadMode.Script)
                                                   .Params(new { containerId = "CumulativeContainer", scId=Model.Id})
                                              )
                            ),
    
    
                        Html.X().Panel()
                            .Margin(0).Padding(5)
                            .Title("Monthly")
                            .ID("Panel2")
                            .Items(Html.X().Container()
                                       .ID("MonthlyContainer")
                                       .DefaultAnchor("100%")
                                       .Loader(
                                                Html.X().ComponentLoader().LoadMask(x=>x.ShowMask = true)
                                                    .Url(Url.Action("LoadMonthlyPartialView"))
                                                    .AutoLoad(true).Mode(LoadMode.Script)
                                                    .Params(new { containerId = "MonthlyContainer", scId=Model.Id })
                                              )
    
    
                                  )
                )//Tab Panel
         
         )
    //Tab1 Partial View
    @(Html.X().Container().Border(false)
          .ID("Container1")
          .Height(400)
          .Layout(LayoutType.Fit)
          .Control(item => this.Initchartcumulative(item))
    )
    
    //Tab2 Partial View
    @(Html.X().Container().Border(false)
          .ID("Container2")
          .Height(400)
          .Layout(LayoutType.Fit)
          .Control(item => this.Initchartmonthly(item))
    )
    //Controller Code:
     public Ext.Net.MVC.PartialViewResult LoadTabularPartialView(string containerId, int Id)
            {
                
                GraphParameters paras = _readService.GetDataById(id).TheEntity;
    
                return new Ext.Net.MVC.PartialViewResult
                {
                    ContainerId = containerId,
                    Model = paras,
                    ViewName = "TabPanelPartailView",
                    WrapByScriptTag = false
                };
            }
    
    
            public Ext.Net.MVC.PartialViewResult LoadCumulativePartialView(string containerId, int Id)
            {
    
                CumulativeGraphModel model = new CumulativeGraphModel();
                model = _readService.GetCumulativeGraph(Id).TheEntity;
                return new Ext.Net.MVC.PartialViewResult
                {
                    ContainerId = containerId,
                    Model = model,
                    ViewName = "CumulativePartialView",
                    WrapByScriptTag = false
                };
            }
    
    
            public Ext.Net.MVC.PartialViewResult LoadMonthlyPartialView(string containerId, int Id)
            {
    
                MonthlyGraphModel model = new MonthlyGraphModel();
                model = _readService.GetMonthlyGraph(Id).TheEntity;
                return new Ext.Net.MVC.PartialViewResult
                {
                    ContainerId = containerId,
                    Model = model,
                    ViewName = "MonthlyPartialView",
                    WrapByScriptTag = false
                };
            }
    Thanks
    Last edited by PriceRightHTML5team; Sep 03, 2013 at 6:06 AM.
  4. #4
    I cannot run the test case. I have no models here that you are using in the controller actions. Are they required to reproduce the issue? Can I just omit them?

    I tried to omit and am getting this JavaScript error:
    ReferenceError: getParammeters is not defined
    mainContainer.loader.paramsFn = getParammeters;
  5. #5
    Quote Originally Posted by Daniil View Post
    I cannot run the test case. I have no models here that you are using in the controller actions. Are they required to reproduce the issue? Can I just omit them?

    I tried to omit and am getting this JavaScript error:
    ReferenceError: getParammeters is not defined
    mainContainer.loader.paramsFn = getParammeters;
    Hi,

    "getParammeter" is custom function which return parameter i.e (containerId & unique id)

    Yes you can omit it, just hardcode the containerid in controller action.

    Thanks
  6. #6
    Well, as far as I can see you are already passing containerid via Params.

    So, I removed
    mainContainer.loader.paramsFn = getParammeters;
    and
    , int Id
    for the controller actions' signatures.

    Then I had to remove
    .Control(item => this.Initchartcumulative(item))
    .Control(item => this.Initchartmonthly(item))
    because it threw errors and replaced it with:
    .Html("Container1")
    .Html("Container2")
    to be able to see that the partial views are actually loaded.

    Then I finally ran the test case and click the button. All the partial views appears to be loaded as expected. So, I cannot reproduce the issue.

    Please provide a full, runnable and simplified test case which we can copy, paste and run without any changes from our side.
  7. #7
    Quote Originally Posted by Daniil View Post
    Well, as far as I can see you are already passing containerid via Params.

    So, I removed
    mainContainer.loader.paramsFn = getParammeters;
    and
    , int Id
    for the controller actions' signatures.

    Then I had to remove
    .Control(item => this.Initchartcumulative(item))
    .Control(item => this.Initchartmonthly(item))
    because it threw errors and replaced it with:
    .Html("Container1")
    .Html("Container2")
    to be able to see that the partial views are actually loaded.

    Then I finally ran the test case and click the button. All the partial views appears to be loaded as expected. So, I cannot reproduce the issue.

    Please provide a full, runnable and simplified test case which we can copy, paste and run without any changes from our side.
    Hi,
    In this.Initchartmonthly(item) we are creating the graph & binding it to the container:

    Below is the snippet:

    private void Initchart(Container pnlGrafico)
        {
    
            Ext.Net.Chart chtGrafico = new Ext.Net.Chart()
            {
                ID = "LineChart",
                Animate = true,
                Height = 300,
                Shadow = true
            };
    
          /// we dynamicallly create chart below and then add it to the container
    
     pnlGrafico.Items.Add(chtGrafico);
    }
    Is this might be the issue of creating dynamic chart and then appending

    Please let me know
  8. #8
    Quote Originally Posted by PriceRightHTML5team View Post
    Is this might be the issue of creating dynamic chart and then appending
    I think it might be.

Similar Threads

  1. [CLOSED] Load MultiSelectCombobox during button click direct event
    By OSYS_FMS in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 02, 2012, 1:30 PM
  2. [CLOSED] Ie7 / 8 button submit issue
    By drgw74 in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 11, 2012, 10:25 AM
  3. [CLOSED] Partial View & FormPanel Submit
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 14, 2011, 12:01 PM
  4. Replies: 1
    Last Post: Mar 22, 2010, 2:39 PM
  5. Replies: 4
    Last Post: Dec 07, 2009, 1:46 PM

Posting Permissions