Dec 12, 2011, 5:28 PM
Custom control - store has rows but all fields are blank
I've seen some other ppl post something similar, but did not see any solutions. I'm trying to encapsulate a grid in a custom control so the same grid/store can be used in multiple places without recoding.
When I load the grid, I call FCATGrid.RefreshData(x) from server side code. The store gets 1000+ records, but all fields are blank. If I click refresh on the grid, same thing happens. Any ideas?
Is there a better way to get this done?
When I load the grid, I call FCATGrid.RefreshData(x) from server side code. The store gets 1000+ records, but all fields are blank. If I click refresh on the grid, same thing happens. Any ideas?
Is there a better way to get this done?
<ToolboxData("<{0}:FCATGrid runat=server></{0}:FCATGrid>")> _
Public Class FCATGrid
Inherits Ext.Net.GridPanel
Private WithEvents PagedStore As New Ext.Net.Store
<Serializable()> _
Public Class FCATDataObject
Public Property StudentID As String
Public Property Name As String
End Class
Private Sub FCATGrid_Init(sender As Object, e As System.EventArgs) Handles Me.Init
'include script
Dim scriptLocation As String = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "VCControls.FCATGrid.js")
Page.ClientScript.RegisterClientScriptInclude("VCControls.FCATGrid.js", scriptLocation)
End Sub
#Region "Constructors"
Public Sub New()
'bottom bar
Dim BottomBar As New Ext.Net.PagingToolbar
With BottomBar
.ID = "PagingToolbar1"
.DisplayInfo = True
.LabelStyle = "font-weight:bold;"
.DisplayMsg = "Displaying students {0} - {1} of {2}"
.EmptyMsg = "No students to display"
End With
Me.BottomBar.Add(BottomBar)
Dim objStore As Ext.Net.Store = PagedStore
Dim objReader As New Ext.Net.ArrayReader
With objReader
.IDProperty = "StudentID"
.Fields.Add("StudentID")
.Fields.Add("Name")
End With
objStore.Reader.Add(objReader)
objStore.DirectEventConfig.Timeout = 120000
Store.Add(objStore)
'Demo data: columns 0-9
Dim fullName As New Ext.Net.Column With {.ColumnID = "fullName", .Header = "Full Name", .DataIndex = "Name", .Width = "150", .Hideable = False}
ColumnModel.Columns.Add(fullName)
End Sub
Public Sub New(ByVal config As GridPanel.Config)
MyBase.New(config)
End Sub
#End Region
Public Function GetData() As List(Of FCATDataObject)
Return GetData(0)
End Function
Public Function GetData(ByVal GroupID As Long) As List(Of FCATDataObject)
.
.
.
Return objList
End Function
Public Sub RefreshData(ByVal GroupID As Long)
GetStore().DataSource = GetData(GroupID)
GetStore().DataBind()
Me.DataBind()
End Sub
End Class