[CLOSED] Proble to launc a resize function from Resource manager

  1. #1

    [CLOSED] Proble to launc a resize function from Resource manager

    Hello

    In the example below, the tesResize function is nether called when I try to resize the browser window.

    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="Panel=Ext.Net.Panel" %>
    <%@ Import Namespace="Ext.Net.Utilities" %>
    
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Dynamically add a new Panel to a Parent Items Collection - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
        <script type="text/javascript">
    
            var testResize = function () {
                alert("resize");
            }
    
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server"  ScriptMode="Debug">
                <Listeners>
                    <WindowResize Fn="testResize"></WindowResize>
                </Listeners>
            </ext:ResourceManager>
    
            <h1>Resize browser window test</h1>
    
              <ext:Panel
                ID="Panel1"
                runat="server"
                Title="Accordion"
                MinHeight="215"
                Flex="1"
                  Html="Resize the window to call the resource manger resize function"
                Layout="VBoxLayout">
                <LayoutConfig>
                    <ext:VBoxLayoutConfig Align="Stretch" Pack="Start"></ext:VBoxLayoutConfig>
                </LayoutConfig>
                  
            </ext:Panel>
        </form>
    </body>
    </html>
    On first launch I get an error :
    Uncaught ReferenceError: testResize is not defined
    at ext.axd:2

    ANd after that, it nether works.

    Besides, if I call the function from debuh console, it works.

    So how could I use this functionality, to launch a function when the browser is resized?
    Last edited by fabricio.murta; Feb 19, 2018 at 4:36 PM.
  2. #2
    Hello @feanor91!

    That's right, and expected to happen. When you add ResourceManager, it adds header topmost of the page's header block. You should either add the script within the ext:ResourceManager block or add a ResourcePlaceholder tag after the script block you define testResize.

    In other words, just add the line

    <ext:ResourcePlaceHolder runat="server" />
    between your code lines 20 and 21 and you should be good.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Devil is in the details....Just you have to know the details.

    Works like a charm, thanks.
  4. #4
    Hi @feanor91!

    Thanks for the feedback, and glad it worked!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] [#511] Resource manager addscript in IE
    By iansriley in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Jun 23, 2014, 9:36 AM
  2. [CLOSED] Resource manager
    By MTSI in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 04, 2014, 3:07 PM
  3. Replies: 3
    Last Post: Aug 10, 2013, 6:23 AM
  4. [CLOSED] What is the Resource Manager and how do I use it?
    By jwf in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 29, 2011, 6:46 PM
  5. Script Manager and Resource Manager Conflict
    By EugeneNiemand in forum 1.x Help
    Replies: 6
    Last Post: Jun 20, 2011, 7:34 AM

Posting Permissions