Results 1 to 4 of 4

Thread: ExtJS 4 and ASP.Net - renderTo on MasterPage

  1. #1
    Sencha User
    Join Date
    Aug 2014
    Posts
    30
    Answers
    1

    Default ExtJS 4 and ASP.Net - renderTo on MasterPage

    Hello,

    I have a problem with the renderTo property while using it with asp.net master pages, and my ext js code is on a separated file. The problem is that the panel do not render.

    Extjs.js

    Code:
    var myPanel = Ext.create('Ext.TabPanel', {
        renderTo: 'myDivId',
        ...
    });
    home.aspx
    Code:
    <asp:Content ID="Content2" ContentPlaceHolderID="cphHeader" runat="server">
            <script type="text/javascript" src="Extjs.js"></script>
    </asp:Content>
    
    
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
            <div id="myDivId">
            </div>
    </asp:Content>
    If i use like this, don't work but if put my all the javascript code inside the script tag on the aspx file, works just fine.

    Code:
    <script type="text/javascript">
    var myPanel = Ext.create('Ext.TabPanel', {
        renderTo: 'myDivId',
        ...
    });
    </script>
    Someone knows this problem ? renderTo is not finding my DIV by the ID if the code is not on the same file, how can I resolve this ?

    thanks

  2. #2
    Sencha User
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505

    Default

    Are you creating your panel inside of:

    Code:
    Ext.onReady(function () {
        // Create the panel and render it to the target div
    });
    or within the launch method of Ext.application()?

    Code:
    Ext.application({
        name: 'MyApp',
        launch: function () {
            // Create the panel and render it to the target div
        }
    });
    If not, you'll need to so that the render action doesn't happen until the DOM has been rendered out.

  3. #3
    Sencha User
    Join Date
    Aug 2014
    Posts
    30
    Answers
    1

    Default

    Hello. thanks for the reply

    Yes, its is inside the Ext.onReady.

    The problem is, if all my javascript code is in the same file as the HTL is, works, but if I separate my JS from the file, doesn't work. maybe loses reference, idk.

  4. #4
    Sencha User
    Join Date
    Aug 2014
    Posts
    30
    Answers
    1

    Default

    Hello .. I can't fix this, anyone can help ? thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •