[CLOSED] The Tpl can not be empty

  1. #1

    [CLOSED] The Tpl can not be empty

    I cannot figure out what this means. We are converting from 1.0 and this logic is largely unchanged:

    <ItemTpl runat="server">
        <Html>
            <tpl for=".">
       <tpl if="[xindex] == 1">
        <table class="cbSubstantiationPlan-list">
         <tr>
          <th>Plan</th>
          <th>Balance</th>
         </tr>
       </tpl>
       <tr class="list-item">
        <td style="padding:3px 0px;">{DisplayName}</td>
        <td>{Balance}</td>
       </tr>
       <tpl if="[xcount-xindex]==0">
        </table>
       </tpl>
      </tpl>
        </Html>
    </ItemTpl>
    At runtime, this gives us the error "The Tpl can not be empty", and I just don't know what that means.

    Thanks.
    Last edited by Daniil; Nov 12, 2012 at 4:11 PM. Reason: [CLOSED]
  2. #2
    Hello!

    Sorry, but can you post example of your code?
  3. #3
    Hi Steve,

    Yes, a sample is required.

    I checked an online example. It works well.
    https://examples2.ext.net/#/Form/Com...rop_Down_List/

    Also it works well with the latest sources from SVN.

    Please clarify what Ext.NET sources do you actually use?
  4. #4
    I appreciate the reply. I decided to attempt to encapsulate the issue, and I am not getting the error message, but I am seeing a new problem. I used the example at https://examples2.ext.net/#/Form/Com...rop_Down_List/. Here is the <ItemTpl> section that illustrates my new problem:
    <ItemTpl runat="server">
        <Html>
            <tpl for=".">
       <tpl if="xindex == 1">
        <table>
         <tr>
          <th>Index</th>
          <th>State</th>
          <th>Details</th>
         </tr>
       </tpl>
       <tr class="list-item">
        <td style="padding:3px 0px;">{[xindex]}</td>
        <td style="padding:3px 0px;">{state}</td>
        <td>{nick:ellipsis(15)}, {price:usMoney}</td>
       </tr>
       <tpl if="xcount-xindex==0">
        </table>
       </tpl>
      </tpl>
     </Html>    
    </ItemTpl>
    See that the xindex is always rendering as "1" regardless on what record of the store that it is displaying. Is there something that has to be done in the store to get the xtemplate to see the proper 1-base record index?

    Thanks.
    -Steve
  5. #5
    Also, I am just unable to duplicate the original problem in a small set of code. However, here is the stack trace information that points to where the exception is being generated in the Ext.NET code:

    [Exception: The Tpl can not be empty]
    Ext.Net.DataView.CheckProperties() in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2\Ext.Net\Ext\View\DataView.cs:75
    Ext.Net.AbstractDataView.OnPreRender(EventArgs e) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2\Ext.Net\Ext\View\AbstractDataView.cs:31
    System.Web.UI.Control.PreRenderRecursiveInternal() +103
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
    So, what is the condition that causes the exception message?

    Thanks again,
    -Steve
    Last edited by Daniil; Nov 12, 2012 at 10:56 AM. Reason: Please use [CODE] tags
  6. #6
    Can you show control which uses your template and store?
  7. #7
    Quote Originally Posted by SFritsche View Post
    I appreciate the reply. I decided to attempt to encapsulate the issue, and I am not getting the error message, but I am seeing a new problem. I used the example at https://examples2.ext.net/#/Form/Com...rop_Down_List/. Here is the <ItemTpl> section that illustrates my new problem:
    <ItemTpl runat="server">
        <Html>
            <tpl for=".">
       <tpl if="xindex == 1">
        <table>
         <tr>
          <th>Index</th>
          <th>State</th>
          <th>Details</th>
         </tr>
       </tpl>
       <tr class="list-item">
        <td style="padding:3px 0px;">{[xindex]}</td>
        <td style="padding:3px 0px;">{state}</td>
        <td>{nick:ellipsis(15)}, {price:usMoney}</td>
       </tr>
       <tpl if="xcount-xindex==0">
        </table>
       </tpl>
      </tpl>
     </Html>    
    </ItemTpl>
    See that the xindex is always rendering as "1" regardless on what record of the store that it is displaying. Is there something that has to be done in the store to get the xtemplate to see the proper 1-base record index?

    Thanks.
    -Steve


    This happens because you are starting new loop by adding for=".", but you are already in ComboBox rendering loop. Please delete for from tpl tag and try again. Maybe this will help you to find the source of your problem. BTW, be careful with table markup. Look at this example:

    <!DOCTYPE html>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e) {
            this.Store1.DataSource = new object[]
            {
                new object[]{"AL", "Alabama", "The Heart of Dixie", 5.99},
                new object[] { "AK", "Alaska", "The Land of the Midnight Sun", 5.99},
                new object[] { "AZ", "Arizona", "The Grand Canyon State", 5.99}
            };
    
            this.Store1.DataBind();
        }
    </script>
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Comboboxes - Ext.NET Examples</title>
        <style type="text/css">
            .list-item
            {
                font: normal 11px tahoma, arial, helvetica, sans-serif;
                padding: 3px 10px 3px 10px;
                border: 1px solid #fff;
                border-bottom: 1px solid #eeeeee;
                white-space: normal;
                color: #555;
            }
            
            .list-item h3
            {
                display: block;
                font: inherit;
                font-weight: bold;
                margin: 0px;
                color: #222;
            }
        </style>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:ComboBox runat="server" Width="250" Editable="false" DisplayField="state" ValueField="abbr"
            TypeAhead="true" QueryMode="Local" ForceSelection="true" TriggerAction="All"
            EmptyText="Select a state..." SelectOnFocus="true">
            <Store>
                <ext:Store ID="Store1" runat="server">
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="abbr" />
                                <ext:ModelField Name="state" />
                                <ext:ModelField Name="nick" />
                                <ext:ModelField Name="price" Type="Float" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ListConfig>
                <ItemTpl runat="server">
                    <Html>
                        <tpl><%--<tpl for=".">--%>
                             {[xindex]}.{abbr}
                      </tpl>
                    </Html>
                </ItemTpl>
            </ListConfig>
        </ext:ComboBox>
        </form>
    </body>
    </html>
  8. #8

    Final Answer

    OK, the final answer as to why the message "The Tpl can not be empty" is that it had nothing to do with the ext:ComboBox. It was the ext:DataView in a completely different control on the page. The ext:DataView requires a template:
    <Tpl runat="server">
    I had incorrectly coded one with
    <RenderTpl>
    instead.

    Thanks.
    -Steve

Similar Threads

  1. always get empty value from textfield
    By robertgan in forum 1.x Help
    Replies: 1
    Last Post: Feb 09, 2012, 8:20 AM
  2. The empty template for GridPanel
    By AlexMaslakov in forum 1.x Help
    Replies: 1
    Last Post: Aug 25, 2011, 12:42 PM
  3. Empty value in combo box
    By glenh in forum 1.x Help
    Replies: 0
    Last Post: Oct 12, 2010, 9:19 PM
  4. Empty NumberField
    By yyyhxm1 in forum 1.x Help
    Replies: 3
    Last Post: Aug 23, 2010, 2:50 AM
  5. Replies: 0
    Last Post: Jun 26, 2009, 11:32 AM

Posting Permissions