Here is a sample page I wrote binding a DataSet with a DataRelation to the WebGrid (producing a hierarchical grid). The issue is that when you run this sample, drag row_id of band 0 to the group by row, no longer are you able to expand all the way out without the grid reloading itself.
Here are the steps:
1) Group by row_id of band 0.
2) Expand using the first + button.
3) Expand using the second + button.
As soon as step 3 is attempted, the grid instead of displaying the contents goes back to results of step 1.
Where am I going wrong?
CODE:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %><%@ Register TagPrefix="igmisc" Namespace="Infragistics.WebUI.Misc" Assembly="Infragistics2.WebUI.Misc.v7.2, Version=7.2.20072.61, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %><%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics2.WebUI.UltraWebGrid.v7.2, Version=7.2.20072.61, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> </head><body> <form id="form1" runat="server"> <p> <igtbl:ultrawebgrid id="UltraWebGrid1" runat="server" Browser="Xml"> <DisplayLayout RowSelectorsDefault="No" Name="UltraWebGrid1" CellSpacingDefault="1" CellPaddingDefault="3" CellClickActionDefault="CellSelect" SelectTypeCellDefault="Extended" AllowSortingDefault="OnClient" HeaderClickActionDefault="SortSingle" ViewType="OutlookGroupBy" LoadOnDemand="Xml"> <RowStyleDefault CssClass="GridRow"> </RowStyleDefault> <HeaderStyleDefault CssClass="GridHeader"> </HeaderStyleDefault> <RowAlternateStyleDefault CssClass="GridAlternatingRow"> </RowAlternateStyleDefault> <GroupByBox> <BoxStyle CssClass="GridHeader"></BoxStyle> </GroupByBox> <Pager Alignment="Left" PagerAppearance="Both"> <PagerStyle CssClass="Pager" /> </Pager> </DisplayLayout> <Bands > <igtbl:UltraGridBand> </igtbl:UltraGridBand> </Bands> </igtbl:ultrawebgrid> </p> </form></body></html>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Imports Infragistics.WebUI.UltraWebGridImports System.DrawingImports System.DataPartial Class test Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then BindGrid() End If End Sub Private Sub BindGrid() Dim table1 As New DataTable Dim table2 As New DataTable Dim myDataSet As New DataSet Dim tmpRow As DataRow Try With table1 .Columns.Add("row_id", GetType(Integer)) .Columns.Add("descr", GetType(String)) End With With table2 .Columns.Add("row_id", GetType(Integer)) .Columns.Add("descr", GetType(String)) End With For i As Integer = 0 To 200 tmpRow = table1.NewRow tmpRow("row_id") = i tmpRow("descr") = "Band 0 - Row " & i.ToString table1.Rows.Add(tmpRow) Next For i As Integer = 0 To 200 tmpRow = table2.NewRow tmpRow("row_id") = i tmpRow("descr") = "Band 1 - Row " & i.ToString & " item 1" table2.Rows.Add(tmpRow) tmpRow = table2.NewRow tmpRow("row_id") = i tmpRow("descr") = "Band 1 - Row " & i.ToString & " item 2" table2.Rows.Add(tmpRow) Next myDataSet.Tables.Add(table1) myDataSet.Tables.Add(table2) Dim rel1 As New DataRelation("rel1", table1.Columns("row_id"), table2.Columns("row_id")) myDataSet.Relations.Add(rel1) ViewState("myDataSet") = myDataSet Catch ex As Exception Response.Write(ex.Message) End Try End Sub Protected Sub UltraWebGrid1_InitializeDataSource(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs) Handles UltraWebGrid1.InitializeDataSource UltraWebGrid1.DataSource = ViewState("myDataSet") UltraWebGrid1.DataBind() End Sub Protected Sub UltraWebGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles UltraWebGrid1.InitializeLayout e.Layout.ActivationObject.BorderStyle = BorderStyle.None e.Layout.HeaderStyleDefault.Wrap = True e.Layout.HeaderStyleDefault.Cursor = Infragistics.WebUI.Shared.Cursors.Hand ' turn on paging e.Layout.Pager.AllowPaging = True ' set up the page size e.Layout.Pager.PageSize = 100 e.Layout.RowsRange = 100 '''''''''''''''BAND 0'''''''''''''''''''''''''''''''''''''''''''''''' With e.Layout.Bands(0).Columns.FromKey("row_id") .Header.Caption = "Row ID" .CellStyle.HorizontalAlign = HorizontalAlign.Right .SelectedCellStyle.BackColor = Color.LightGreen .Width = Unit.Pixel(3) End With With e.Layout.Bands(0).Columns.FromKey("descr") .Header.Caption = "Description" .CellStyle.HorizontalAlign = HorizontalAlign.Left .SelectedCellStyle.BackColor = Color.LightGreen .Width = Unit.Pixel(192) End With '''''''''''''''BAND 1'''''''''''''''''''''''''''''''''''''''''''''''' With e.Layout.Bands(1).Columns.FromKey("row_id") .Header.Caption = "Row ID" .CellStyle.HorizontalAlign = HorizontalAlign.Right .SelectedCellStyle.BackColor = Color.LightGreen .Width = Unit.Pixel(3) End With With e.Layout.Bands(1).Columns.FromKey("descr") .Header.Caption = "Description" .CellStyle.HorizontalAlign = HorizontalAlign.Left .SelectedCellStyle.BackColor = Color.LightGreen .Width = Unit.Pixel(192) End With End SubEnd Class