[CLOSED] Fit layout doesn't work when loading a user control using MVC

  1. #1

    [CLOSED] Fit layout doesn't work when loading a user control using MVC

    I'm loading a user control from a MVC controller action. However, whatever I'm trying, I cannot get the control to fit the viewport's height, it just stays as small as it would be without the fit layout.

    Here's the code (note the Layout attribute on the panel):

    <ext:Viewport runat="server">
        <Content>
            <ext:Button runat="server" Text="Load">
                <Listeners>
                    <Click Handler="#{Panel1}.load({ scripts: true, params: { containerId: #{Panel1}.id }, url: '/Home/Welcome' });" />
                </Listeners>
            </ext:Button>
        </Content>
    </ext:Viewport>
    
    <ext:Panel ID="Panel1" runat="server" Layout="Fit" />
    Here's the controller action:

    public PartialViewResult Welcome(string containerId)
    {
         return new PartialViewResult(containerId, RenderMode.AddTo);
    }
    And here's the user control (Welcome.ascx, implied from the Welcome action):

    <%@ Control Language="C#" %>
    <ext:Panel runat="server">
        <Content>
            Test
        </Content>
    </ext:Panel>
    What should I do?
  2. #2

    RE: [CLOSED] Fit layout doesn't work when loading a user control using MVC

    Hi,

    PartialViewReslt (Ext.Net) creates interim panel. Therefore please wrap your panel inside partial view by FitLayout control. Please see the following post for explanation
    http://forums.ext.net/showthread.php?postid=26583.aspx
  3. #3

    RE: [CLOSED] Fit layout doesn't work when loading a user control using MVC

    Thanks!

    I've tried your solution but it makes no difference... This is how I understood your solution:

    I changed the control code to:

    <%@ Control Language="C#" %>
    <ext:FitLayout runat="server">
        <Items>
            <ext:Panel runat="server">
                <Content>
                    Test
                </Content>
            </ext:Panel>
         </Items>
    </ext:FitLayout>
    I also tried wrapping the panel that hosts the control in a FitLayout (instead of using Layout="Fit") but that doesn't seem to make a difference.
  4. #4

    RE: [CLOSED] Fit layout doesn't work when loading a user control using MVC

    Hi,

    I was confused by your ViewPort. ViewPort always occupies whole page therefore you cannot have ViewPort and Panel as you shown. Move Panel1 inside Items collection of the ViewPort, set Layout="Fit" for the ViewPort and move the button (for example, inside Buttons collection of the Panel1)

    <ext:Viewport runat="server" Layout="Fit">
        <Items>
            <ext:Panel ID="Panel1" runat="server" Layout="Fit">
                <Buttons>
                    <ext:Button runat="server" Text="Load">
                        <Listeners>
                            <Click Handler="#{Panel1}.load({ scripts: true, params: { containerId: #{Panel1}.id }, url: '/Home/Welcome' });" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:Panel>        
        </Items>
    </ext:Viewport>
    Your last code is corrected (partial view) but I recommend to add Inherit for Control tag
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
  5. #5

    RE: [CLOSED] Fit layout doesn't work when loading a user control using MVC

    Allright! I worked it out, thanks for helping me focus and increase my knowledge. In my case (which I didn't fully post here due to its size) I had a border layout inside the view port and the target panel was in the Center region. However, I had another panel sitting next to the the target panel and that appeared to block the fitting process.

    It works great now, thanks again.

    Sandor Drieƫnhuizen,
    Subspace

Similar Threads

  1. Replies: 0
    Last Post: May 16, 2012, 11:29 PM
  2. [CLOSED] GridPanel Cell Tooltips doesn't work in user control
    By skisly in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 09, 2011, 1:57 PM
  3. Dynamic User Control Loading
    By Rupesh in forum 1.x Help
    Replies: 0
    Last Post: Apr 08, 2011, 7:48 AM
  4. Replies: 8
    Last Post: Jan 25, 2011, 4:21 AM
  5. [CLOSED] Direct Methods with return doesn't work in user control
    By sharif in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 13, 2010, 12:00 PM

Posting Permissions