I'm having an issues using custom data bindings features with my asp infragistics webdatagrid. I can get the items to bind to the grid on first load, but when i attempt to page through or even filter on the results nothing returns and my grid goes blank.
First time posting here so if i'm missing something or need to restate anything please let me know.
Thanks for any help!
Here is my code:
ASPX form:
<asp:UpdatePanel ID="ajUpdatePan" runat="server"> <ContentTemplate> <ig:WebDataGrid ID="infGrid" runat="server" Height="350px" Width="1070px"> <Behaviors> <ig:Paging PageSize="100"> </ig:Paging> <ig:Sorting> </ig:Sorting> <ig:RowSelectors> </ig:RowSelectors> <ig:Selection> </ig:Selection> <ig:Filtering> </ig:Filtering> <ig:Activation> </ig:Activation> </Behaviors> </ig:WebDataGrid>
</ContentTemplate>
</asp:UpdatePanel>
Code behind:
Private oList As List(Of FileEntity)
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
'load collection once.
infGrid.DataSource = New List(Of FileEntity)()
end if
end sub
Protected Sub infGrid_CustomDataBinding(sender As Object, e As Infragistics.Web.UI.GridControls.DataBindingEventArgs) Handles infGrid.CustomDataBinding Dim currentPage As Integer Dim pageSize As Integer Dim startIndex As Integer Dim ad As New dataHandler
Dim grid As Infragistics.Web.UI.GridControls.WebDataGrid = sender
grid.ScrollTop = 0
currentPage = grid.Behaviors.Paging.PageIndex pageSize = grid.Behaviors.Paging.PageSize startIndex = currentPage * pageSize
e.Cancel = True e.SelectArguments.TotalRowCount = ad.get_INF_FileCount 'total record count
oList = ad.get_INF_NormalizedFile_NamesInRange(startIndex, pageSize) e.DataSource = oList
End Sub
'file entity class used to fill the webgrid
Imports Microsoft.VisualBasic
Public Class FileEntity
Private m_LOOKUP_CATEGORY As String Private m_REFERENCE_FIELD As String Private m_SOURCE_SYSTEM As String
Public Property LOOKUP_CATEGORY() As String Get Return m_LOOKUP_CATEGORY End Get Set(value As String) m_LOOKUP_CATEGORY = value End Set End Property
Public Property REFERENCE_FIELD() As String Get Return m_REFERENCE_FIELD End Get Set(value As String) m_REFERENCE_FIELD = value End Set End Property
Public Property SOURCE_SYSTEM() As String Get Return m_SOURCE_SYSTEM End Get Set(value As String) m_SOURCE_SYSTEM = value End Set End Property
End Class
'data handler class and the 2 fuctions used to fill the FileEntity class
Public Function get_INF_FileCount() As Integer 'create cnnStr Dim cnnStr As String = System.Configuration.ConfigurationManager.AppSettings("connect") 'using webconfig Dim conn As New OracleConnection(cnnStr) Dim schema As String = System.Configuration.ConfigurationManager.AppSettings("schema")
Dim total As Integer
Try conn.Open()
Dim cmd As New OracleCommand cmd.Connection = conn cmd.CommandText = " SELECT COUNT(1) AS TOTAL FROM ( " & _ " SELECT DISTINCT LOOKUP_CATEGORY, REFERENCE_FIELD, SOURCE_SYSTEM, " & _ " LOOKUP_CATEGORY || REFERENCE_FIELD || SOURCE_SYSTEM AS nKEY FROM <removed>.REF_NORMALIZATION_XREF ORDER BY SOURCE_SYSTEM )"
cmd.CommandType = Data.CommandType.Text Dim dr As OracleDataReader = cmd.ExecuteReader()
While dr.Read
total = dr.Item("TOTAL") End While
Catch ex As Exception ' catches any error ' TODO Finally conn.Close() conn.Dispose() End Try
Return total
End Function
Public Function get_INF_NormalizedFile_NamesInRange(ByRef startIndex As Integer, ByRef count As Integer) As List(Of FileEntity)
Dim fileList As List(Of FileEntity) = New List(Of FileEntity)
'create cnnStr Dim cnnStr As String = System.Configuration.ConfigurationManager.AppSettings("connect") 'using webconfig Dim conn As New OracleConnection(cnnStr) Dim schema As String = System.Configuration.ConfigurationManager.AppSettings("schema")
Dim cmd As New OracleCommand cmd.Connection = conn cmd.CommandText = "SELECT RN, LOOKUP_CATEGORY, REFERENCE_FIELD, SOURCE_SYSTEM FROM " & _ " ( SELECT ROW_NUMBER() OVER (ORDER BY F.SOURCE_SYSTEM) AS RN, F.LOOKUP_CATEGORY, F.REFERENCE_FIELD, " & _ " F.SOURCE_SYSTEM FROM ( SELECT DISTINCT LOOKUP_CATEGORY, REFERENCE_FIELD, SOURCE_SYSTEM,LOOKUP_CATEGORY || REFERENCE_FIELD || SOURCE_SYSTEM " & _ " AS nKEY FROM <removed>.REF_NORMALIZATION_XREF ORDER BY SOURCE_SYSTEM ) F ) " & _ " WHERE RN >= " & startIndex & " AND RN < " & count
While dr.Read Dim tempFile As New FileEntity tempFile.LOOKUP_CATEGORY = dr.Item("LOOKUP_CATEGORY") tempFile.REFERENCE_FIELD = dr.Item("REFERENCE_FIELD") tempFile.SOURCE_SYSTEM = dr.Item("SOURCE_SYSTEM") fileList.Add(tempFile) End While
Return fileList
Hello,
Thank you for contacting Infragistics!
Our Developer Support team is motivated to help you succeed, and we really want to help you. We’ll provide help for questions regarding installation problems, product functionality, programming issues, product usage issues, and will explain any Infragistics-related error messages you receive. We have access to the developers who have written the code, and will work with you to figure out what the issue is, and deliver a solution.
At the same time, requests involving design or planning for your application’s deployment, software development, code review, custom samples, implementation planning, and user experience and visual design are exactly what Infragistics Consulting Services Team can help you with. You can contact them through the following form.