2.2 - Store name is undefined when ascx is loaded

Page 1 of 2 12 LastLast
  1. #1

    2.2 - Store name is undefined when ascx is loaded

    Hi all,

    Im posting a sample of my problem here.

    I have a simple tab panel and when someone click on button or menu open an usercontrol ascx in panel. But something is wrong store name is undefined, no matter what store is.. i tried with gridpanel and a simple combo box.

    I think it is a bug.

    Im using the lastest release published at nuget 2.2

    Look the minified code.

    Aspx.

    <%@ Page Language="C#" AutoEventWireup="true" Inherits="IWATrading.BackOffice.Carrion.WebForm1" %>
    
    <script runat="server">
        protected void AdicionarTab(object sender, DirectEventArgs e)
        {
    
            var control = new UserControlLoader { Path = "comboBox.ascx" };
            var panel = new Ext.Net.Panel
            {
                Title = "combo",
                Layout = "Fit",
            };
    
            panel.Items.Add(control);
    
            this.tabpanel1.Items.Add(panel);
    
            panel.Render();
        }
        
    </script>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <form id="form1" runat="server">
            <ext:Button runat="server" OnDirectClick="AdicionarTab" Text="OpenNewTab"/>
            <ext:TabPanel runat="server" ID="tabpanel1" />
        </form>
    </body>
    </html>
    
    <ext:XScript ID="XScript1" runat="server">
            <script>
                var addTab = function (tabPanel, id, url, menuItem) {
                    var tab = tabPanel.getComponent(id);
    
                    if (!tab) {
                        tab = tabPanel.add({
                            id: id,
                            title: url,
                            closable: true,
                            menuItem: menuItem,
                            Layout: 'Fit',
                            loader: {
                                url: url,
                                renderer: "frame",
                                loadMask: {
                                    showMask: true,
                                    msg: "Loading " + url + "..."
                                }
                            }
                        });
                    }
                    ;
                    tabPanel.setActiveTab(tab);
                }
            </script>
    </ext:XScript>
    usercontrol comboBox.ascx

    <%@ Control Language="C#" AutoEventWireup="true" Inherits="IWATrading.BackOffice.Carrion.comboBox" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Store1.DataSource = new object[] {
                    new object[] { "ID", "ID" },
                    new object[] { "ImageUrl", "ImageUrl"},
                    new object[] { "Description", "Description"},
                    new object[] { "Preco", "Preco"},
                    new object[] { "Nome", "Nome"}
                };
    
            Store1.DataBind();
        }
        
    </script>
    <ext:ComboBox ID="cboReorder" runat="server" Editable="false"
        DisplayField="display" ValueField="value">
        <Store>
            <ext:Store ID="Store1" runat="server">
                <Model>
                    <ext:Model ID="Model1" runat="server">
                        <Fields>
                            <ext:ModelField Name="display" />
                            <ext:ModelField Name="value" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
        </Store>
    </ext:ComboBox>

    error:
    Unable to get property 'proxy' of undefined or null reference

    App.ctl13_Store1 is undefined.

    How can i solve that?

    Regards.
  2. #2
    Hello!

    We are investigating.

    Try the following:

    <%@ Control Language="C#" AutoEventWireup="true"  %>
    
    <script runat="server">
        public object[] Data
        {
            get
            {
                return new object[] {
                    new object[] { "ID", "ID" },
                    new object[] { "ImageUrl", "ImageUrl"},
                    new object[] { "Description", "Description"},
                    new object[] { "Preco", "Preco"},
                    new object[] { "Nome", "Nome"}
                };
            }
        }
    </script>
    
    <ext:ComboBox ID="cboReorder" runat="server" Editable="false"
        DisplayField="display" ValueField="value">
        <Store>
            <ext:Store ID="Store1" runat="server" Data="<%# Data %>" AutoDataBind="True">
                <Model>
                    <ext:Model ID="Model1" runat="server">
                        <Fields>
                            <ext:ModelField Name="display" />
                            <ext:ModelField Name="value" />
                        </Fields>
                    </ext:Model>
                </Model>
                <Reader>
                    <ext:ArrayReader runat="server"/>
                </Reader>
            </ext:Store>
        </Store>
    </ext:ComboBox>
  3. #3
    Hi baidly

    Thanks for reply, its worked for my combobox.. But didnt work for my gridpanel, and i have another problem.

    I set OnReadData="RefreshData" on my store to refresh gridpanel, same problem, cant find the store name.

    Strange because if i put the same code on normal page .aspx everything works like a charm.


    Regards.
  4. #4
    Hi,

    You don't need to call DataBind for store, just remove that line and add ArrayReader to the store
  5. #5
    Quote Originally Posted by Vladimir View Post
    Hi,

    You don't need to call DataBind for store, just remove that line and add ArrayReader to the store
    vladimir, but i dont have any databindbind on my code behind for my gridpanel i just created OnReadData="RefreshData" to click on refresh and got this error

    The control with ID 'id660d8abdf5d58d27_gridStore' not found

    protected void RefreshData(object sender, StoreReadDataEventArgs e)
            {
            }
  6. #6
    Please post a sample reproduces the issue
  7. #7
    you can use the same webform1 aspx above to execute this ascx

    click on refresh button and you get this error.

    comboBox.ascx
    <%@ Control Language="C#" AutoEventWireup="true" Inherits="IWATrading.BackOffice.Carrion.comboBox" %>
    <script runat="server">
    
        public object[] Data
        {
            get
            {
                return new object[] {
                    new object[] { "ID", "ID" },
                    new object[] { "ImageUrl", "ImageUrl"},
                    new object[] { "Description", "Description"},
                    new object[] { "Preco", "Preco"},
                    new object[] { "Nome", "Nome"}
                };
            }
        }
    
        protected void RefreshData(object sender, StoreReadDataEventArgs e)
        {
       
        }
    </script>
    
    
    <ext:GridPanel runat="server">
        <Store>
            <ext:Store ID="Store2" runat="server" Data="<%# Data %>" AutoDataBind="True" OnReadData="RefreshData">
                <Model>
                    <ext:Model ID="Model2" runat="server">
                        <Fields>
                            <ext:ModelField Name="display" />
                            <ext:ModelField Name="value" />
                        </Fields>
                    </ext:Model>
                </Model>
                <Reader>
                    <ext:ArrayReader runat="server"/>
                </Reader>
            </ext:Store>
        </Store>
        <ColumnModel>
            <Columns>
                <ext:Column Text="display" DataIndex="display" />
                <ext:Column Text="value" DataIndex="value" />
            </Columns>
        </ColumnModel>
        <BottomBar>
            <ext:PagingToolbar ID="PagingToolbar1" runat="server" />
        </BottomBar>
    </ext:GridPanel>
  8. #8
    Do you recreate dynamic controls?
  9. #9
    i dont understand, recreate what?

    well the tab panel is created dynamic at this code

    <script runat="server">
        protected void AdicionarTab(object sender, DirectEventArgs e)
        {
     
            var control = new UserControlLoader { Path = "comboBox.ascx" };
            var panel = new Ext.Net.Panel
            {
                Title = "combo",
                Layout = "Fit",
            };
     
            panel.Items.Add(control);
     
            this.tabpanel1.Items.Add(panel);
     
            panel.Render();
        }
         
    </script>
    Last edited by rammus; Apr 21, 2013 at 7:17 AM.
  10. #10
    Each dynamic control must be recreating on server side to handle its events, please see
    http://geekswithblogs.net/shahed/arc...26/123391.aspx
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: Apr 02, 2013, 5:03 AM
  2. [CLOSED] Difference Store behaviour Usercontrol (.ASCX) vs Class (.CS)
    By pschojer in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 18, 2012, 3:51 PM
  3. Replies: 2
    Last Post: Apr 10, 2012, 12:08 PM
  4. Store is undefined
    By roszman in forum 1.x Help
    Replies: 10
    Last Post: May 26, 2010, 9:26 AM
  5. Replies: 1
    Last Post: Feb 24, 2010, 3:05 PM

Tags for this Thread

Posting Permissions