Error with Store when closing window
Hello Coolite Team,
I have created a store on code Behind like this:
Code:
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.
RE: Error with Store when closing window
Hi,
Can you show the code which demonstrates the problem?
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:
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:
Code:
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
Code:
<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; 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]
RE: Error with Store when closing window
Hi,
I think it is need full code because very hard to say whats wrong*
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.
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...
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...
RE: Error with Store when closing window
That's it !
Thank you very much...