WebDataGrid paging using datasets

Not Answered This post has 0 verified answers | 13 Replies | 4 Followers Thread's RSS feed.

merlin63
Points 195
Replied On: Wed, Jun 24 2009 5:32 PM Reply

I'm binding a WebDataGrid (inside a WebPanel) to a dataset, with EnableViewState = 'True',  EnableDataViewState = 'False', and paging behavior. The grid populates fine initially  via a 'Load Data' button, which retrieves the dataset and binds it to the grid.  However, when I choose a paging index, the grid goes blank.  I have the Paging.PageIndexChanged event wired to a method in the code behind which rebinds the grid.  The method is being called. but the grid goes blank. 

  • Post Points: 20

All Replies

nikola82
Points 3,147
Replied On: Thu, Jun 25 2009 3:16 AM Reply

Hi,

I just tested the described scenario and it works perfectly fine for me, no matter if EnableDataViewState is true or false. Can you send us the source or a sample application which reproduces the issue?

 

Best Regards,
Nikola Genov
The Infragistics ASP .NET Team

  • Post Points: 5
merlin63
Points 195
Replied On: Thu, Jun 25 2009 9:38 AM Reply

Please find code attached....

0216.code.txt

  • Post Points: 20
merlin63
Points 195
Replied On: Thu, Jun 25 2009 9:44 AM Reply

Also, if I set EnableDataViewState to TRUE (EnableViewState is also TRUE) and click on the 'Load' button, I get the following exception :

7462.exception.txt

 

Thanks

  • Post Points: 5
nikola82
Points 3,147
Replied On: Thu, Jun 25 2009 12:19 PM Reply

It again works perfectly well, I'm feeding the grid with a sample data DataSet. Are you sure that your CTPBWebService2 always returns properly filled data?

CTPBWebService2 ws = (CTPBWebService2)Session["ctpbdata"];
DataSet ds = ws.GetEntrys();

Best Regards,
Nikola Genov
The Infragistics ASP .NET Team

  • Post Points: 20
merlin63
Points 195
Replied On: Thu, Jun 25 2009 12:40 PM Reply

I stepped through everything, and the web service returns the same dataset each time (it's a hard-coded query from a static oracle table).

 

  • Post Points: 20
[IG] Alex Kartavov
Points 13,619
Replied On: Thu, Jun 25 2009 1:26 PM Reply

Please verify that the latest available Service Release is installed. Thanks!

Alex Kartavov
Infragistics ASP.NET/jQuery Team

Need help? Find the various ways you can ask for help from Infragistics.

  • Post Points: 35
merlin63
Points 195
Replied On: Thu, Jun 25 2009 3:26 PM Reply

I already had SR_2040 installed and just installed SR_2055.  But still no luck...

FYI....In the example code I provided above, if I select a page index the grid goes blank, but when I click on the "Load" button, I get data in the grid at the proper page index I chose earlier.  The only difference is that the button is posting back, but the paging is not since AJAX is enabled....????

To see if other AJAX features were working properly, I added a sorting behavior.  This works fine.  But when I click on a page index AFTER I do a column sort, I get this IE error message:

  • Post Points: 5
merlin63
Points 195
Replied On: Fri, Jun 26 2009 11:14 AM Reply

I did some more digging around found some very strange behavior with the paging mechanism.  I wired the grid DataBound event to a method in the code-behind that did nothing.  I set a breakpoint at this method and for the PageIndexChanged, ColumnSorted, and 'Load' button Click target methods in the code-behind.  When I click on the 'Load' button OR sort a column, the DataBound method is called after the respective handler targets.  But when I click on a page index, the PageIndexChanged method is called but the DataBound method is NOT.

  • Post Points: 5
[IG] Alex Kartavov
Points 13,619
Replied On: Tue, Jun 30 2009 11:46 AM Reply

Hi,

Is it possible for you to post a sample here? Thanks.

Alex Kartavov
Infragistics ASP.NET/jQuery Team

Need help? Find the various ways you can ask for help from Infragistics.

  • Post Points: 32
merlin63
Points 195
Replied On: Tue, Jun 30 2009 12:40 PM Reply
  • Post Points: 20
fscales
Points 195
Replied On: Tue, Nov 17 2009 4:43 PM Reply

Just wondering if this issue ever got resolved.  I'm experiencing the exact same issues.  I am currently running build 9.1.20091.2055 with VS 2005.

  • Post Points: 5
fscales
Points 195
Replied On: Wed, Nov 18 2009 10:23 AM Reply

Paging / Sorting with Datasets FIXED!!

Keep getting the error "DataSource view state corrupt" when
you set the EnableDataViewState equal to 'True' in order to get paging/sorting working?
-------------------------------------------------------------------
DO NOT USE THIS VERSION!!!!  9.1.20091.2055
Paging/Sorting with Datasets fixed in 9.2.20092.1003
Filtering still broken however when the "Clear Filter" button is selected.
Export to Excel component not compatible (must write your own solution)
-------------------------------------------------------------------
PLEASE NOTE:  In order to get the control to work with Datasets it DOES require
some very minor additional code above and beyond just enabling the behaviors. 

Now rather than leaving people hanging here without some code example with the
solution, as seems to be the norm on this site.  I will provide the example that
was provided to me (only after my company applied some pressure to escalate my issue). 
It only worked when I upgraded my software to 9.2.20092.1003.

At first glance, I don't fully understand why some of the events are required to
get it to work (particularly the Page_Unload event) but here is the simple sample...

====================================================================
 Default.aspx
====================================================================
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register TagPrefix="ig" Namespace="Infragistics.Web.UI.GridControls" Assembly="Infragistics2.Web.v9.2, Version=9.2.20092.1003, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Aikido WebDataGrid - Paging/Sorting</title>
</head>
<body>
  <h3>
    Note:  As of this writing, this sample works with 9.2.20092.1003.  <br />
    However, Filtering does not work.
  </h3>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
            <ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="400px"
                EnableDataViewState="true">
                <Behaviors>
                    <ig:Paging PageSize="10" QuickPages="2">
                    </ig:Paging>
                    <ig:Sorting>
                    </ig:Sorting>
                </Behaviors>
            </ig:WebDataGrid>
        </div>
        <asp:Label ID="Label1" runat="server" Text="Enter some Text here:   " Width="154px"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Search" />
    </form>
</body>
</html>

====================================================================
Default.aspx.vb
====================================================================

Imports System.Data
Imports System.Diagnostics

Partial Class _Default
    Inherits System.Web.UI.Page

    Dim ds As DataSet

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        If Session("GridDataSource") Is Nothing Then
            ds = New DataSet
        Else
            ds = TryCast(Session("GridDataSource"), DataSet)
        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim str As String = Me.TextBox1.Text

        If (ds.Tables.Count > 0) Then
            Me.WebDataGrid1.DataSource = ds
            Me.WebDataGrid1.DataBind()

            Me.WebDataGrid1.Visible = True
        Else
            Me.WebDataGrid1.Visible = False
        End If
    End Sub

    Private Function GetDataSet(ByVal str As String) As DataSet
        Dim ds As New DataSet
        Dim dt As New DataTable

        dt.Columns.Add("Col1")
        dt.Columns.Add("Col2")
        dt.Columns.Add("Col3")

        For index As Integer = 1 To 100

            Dim dr As DataRow = dt.NewRow
            dr(0) = str + " Col1 Row" + index.ToString
            dr(1) = str + " Col2 Row" + index.ToString
            dr(2) = str + " Col2 Row" + index.ToString
            dt.Rows.Add(dr)

        Next

        ds.Tables.Add(dt)

        Return ds
    End Function

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        ds = GetDataSet(TextBox1.Text)

        If (Not ds Is Nothing) Then
            Me.WebDataGrid1.DataSource = ds
            Me.WebDataGrid1.DataBind()

            Me.WebDataGrid1.Visible = True
        End If
    End Sub

    Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
        Session("GridDataSource") = ds
    End Sub

End Class

  • Post Points: 20
[IG] Alex Kartavov
Points 13,619
Replied On: Wed, Nov 18 2009 2:40 PM Reply

There is another 9.1 hotfix out. We'd appreciate if you let us know whether it's working there too. Thanks.

Alex Kartavov
Infragistics ASP.NET/jQuery Team

Need help? Find the various ways you can ask for help from Infragistics.

  • Post Points: 5
Page 1 of 1 (14 items) | RSS