Error with Store when closing window

  1. #1

    Error with Store when closing window

    Hello Coolite Team,

    I have created a store on code Behind like this:
    Public cooliteStore As New Coolite.Ext.Web.Store
    cooliteStore.ID = "myStoreID"
    ...
    ...
    Evething works perfectlly but when I close/hide the windows where the page with the above code behind is, I got the error:
    <style type="text/css">body{border:0;margin:0;padding:3px;height:98% ;cursor:text;}</style><h2>The Control with ID = 'myStoreID' not found </h2>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: The Control with ID = 'myStoreID' not found


    What I could do to avoid this error once I'm planning to create and manage all my Stores on code behind ?

    Regards.
  2. #2

    RE: Error with Store when closing window

    Hi,

    Can you show the code which demonstrates the problem?


    Vladimir Shcheglov
    Sr. Developer
  3. #3

    RE: Error with Store when closing window

    Hi Vladsch,

    I have created a general use class to configure the store that I'll use only fox comboboxes.
    Here my code:
      Public Class TCooliteSimpleStore
            Public cooliteStore As New Coolite.Ext.Web.Store
            Private Shared _fieldList As New Coolite.Ext.Web.ArrayReader
            Private Shared _arrayList As New ArrayList
    
    
            Protected Friend Sub init(ByRef myHolder As System.Web.UI.WebControls.PlaceHolder)
                'FIELDS
                _fieldList.ReaderID = "myListID"
                _fieldList.Fields.Add(New RecordField("field0", RecordFieldType.String))
                _fieldList.Fields.Add(New RecordField("field1", RecordFieldType.String))
                _fieldList.Fields.Add(New RecordField("field2", RecordFieldType.String))
    
                cooliteStore.ID = "myStoreID"
                myHolder.Controls.Add(cooliteStore)
                cooliteStore.Reader.Add(_fieldList)
    
                _arrayList.Clear()
            End Sub
    
            Protected Friend Sub addData(ByVal myValue As String, ByVal campo1 As String, Optional ByVal campo2 As String= "")
                _arrayList.Add(New Object() {myValue, campo1, campo2})
            End Sub
    
            Protected Friend Sub bindData()
                cooliteStore.DataSource = _arrayList
                cooliteStore.DataBind()
            End Sub
    
        End Class
    And, that's the way I use it:

            Protected Friend Sub loadMyUsers()
                Dim tb_table = New TDatabase
                Dim myStore As New TCooliteSimpleStore
    
                    myStore.init(.PlaceHolder1)
                    
                    tb_table.SQL.clear()
                    tb_table.SQL.add("SELECT ...")
                    tb_table.Open()
    
                    If (tb_table.isEmpty) Then
                        Exit Sub
                    End If
    
                    While (Not tb_table.EOF)
                        myStore.addData(tb_table.getData("userID"), tb_table.getData("name"))
                        tb_table.moveNext()
                    End While
                    
                    myStore.bindData()
    
            End Sub

    Client Side
    <body>
        <form id="form1" runat="server">
        
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
        
    
        <ext:Window
             ID="Window1" 
             runat="server"  
             Height="429px" 
             Icon="Group" 
             Title="Usuários &amp;amp; Grupos" 
             Width="710px" 
             Resizable="false">
            <Body>
                <ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="0" Height="365px">
                    <Tabs>
                        <ext:Tab runat="server" Title="Usuários" ID="ctl5962" Icon="User">
                            <Body>
                                <ext:BorderLayout ID="BorderLayout1" runat="server">
                                    <West Collapsible="false" Split="true">
                                        <ext:Panel ID="Panel1" runat="server" Title="Usuários"  Frame="true">
                                            <Body>
                                                         <ext:ComboBox ID="cmb_usuarios" runat="server">
                                                         </ext:ComboBox>     
                                            </Body>
                                        </...>
    What's I'm missing ?


    [/CODE]
  4. #4

    RE: Error with Store when closing window

    Hi,

    I think it is need full code because very hard to say whats wrong 


    Vladimir Shcheglov
    Sr. Developer
  5. #5

    RE: Error with Store when closing window

     Make sure your store is added above any layout controls.  I have experience similar errors if my store is nested inside layout controls.  What I usually do is add a ASP:PlaceHolder after the Ext:ScriptManager and dynamically add stores to the placeholder.
  6. #6

    RE: Error with Store when closing window

    As you can see in the client side code above, that's what I did... but the error continues...
  7. #7

    RE: Error with Store when closing window

    Are you doing any kind of postbacks? If so, are you recreating your store every time? Dynamically created controls must be created on every postback...
  8. #8

    RE: Error with Store when closing window

    That's it !

    Thank you very much...

Similar Threads

  1. Replies: 2
    Last Post: Apr 19, 2012, 9:51 PM
  2. viewstate error after closing iframe window
    By pstorch in forum 1.x Help
    Replies: 0
    Last Post: Mar 01, 2012, 11:32 AM
  3. Replies: 7
    Last Post: Feb 09, 2012, 12:17 PM
  4. Replies: 1
    Last Post: Nov 11, 2011, 3:48 PM
  5. Replies: 3
    Last Post: Jun 28, 2010, 6:14 PM

Posting Permissions