I'm using one WebHierarchicalDataGrid on my page. When page is postback around 5-6 times, I am getting below mentioned error:
----------------------Begin-------------------------------------
[IndexOutOfRangeException: Index was outside the bounds of the array.] Infragistics.Web.UI.GridControls.GridBot.LoadClientCollections(Object[] collections) +2165 Infragistics.Web.UI.Framework.RunBot.LoadClientData() +43 Infragistics.Web.UI.Framework.RunBot.HandleLoadPostData(String postDataKey, NameValueCollection postCollection) +25 Infragistics.Web.UI.GridControls.ContainerGrid.LoadPostData(String postDataKey, NameValueCollection postCollection) +80 System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +1068 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3406
----------------------End-------------------------------------
I'm wondering if this error occurs because my WebHierarchicalDataGrid is too big, or are there any possibilities to cause this problem?
Below is the code defination:
---------------------Begin---------------------------------------
<igtbl:WebHierarchicalDataGrid ID="DEPA" runat="server" AutoGenerateColumns="false" AutoGenerateBands="false" DataKeyFields="ID" EnableDataViewState="true" InitialDataBindDepth="-1" Width="99%" EnableAjax="false" Key="PARTICIPANTS"> <ClientEvents Initialize="DEPA_Initialize" /> <Columns> <igtbl:BoundDataField Key="ID" DataFieldName="ID" Hidden="true"></igtbl:BoundDataField> <igtbl:BoundDataField Key="TYPEDESC" DataFieldName="TYPEDESC" Width="70%"></igtbl:BoundDataField> <igtbl:TemplateDataField Key="ADDSTD"> <ItemTemplate> <asp:LinkButton ID="lnkAddStudent" runat="server" Text="Add" CssClass="HyperLink_Text" Width="10%"></asp:LinkButton> </ItemTemplate> </igtbl:TemplateDataField> <igtbl:TemplateDataField Key="ADDSTFF"> <ItemTemplate> <asp:LinkButton ID="lnkAddStaff" runat="server" Text="Add Staff" CssClass="HyperLink_Text" Width="10%"></asp:LinkButton> </ItemTemplate> </igtbl:TemplateDataField> <igtbl:TemplateDataField Key="ADDVSTR"> <ItemTemplate> <asp:LinkButton ID="lnkAddVisitor" runat="server" Text="Add Visitor" CssClass="HyperLink_Text" Width="10%"></asp:LinkButton> </ItemTemplate> </igtbl:TemplateDataField> </Columns> <Bands> <igtbl:Band Key="OFFENDERS" AutoGenerateColumns="false" DataKeyFields="ID,IncidentId,StudentId"> <Columns> <igtbl:TemplateDataField Key="View" Width="20px"> <ItemTemplate> <asp:ImageButton ID="btnView" runat="server" CommandArgument="OFFENDERS" OnCommand="btnView_Command" ImageUrl="~/Images/Icons/Zoom16.gif" /> </ItemTemplate> </igtbl:TemplateDataField> <igtbl:TemplateDataField Key="Edit" Width="20px"> <ItemTemplate> <asp:ImageButton ID="btnEdit" runat="server" CommandArgument="OFFENDERS" OnCommand="btnEdit_Command" ImageUrl="~/Images/Icons/Edit16.gif" /> </ItemTemplate> </igtbl:TemplateDataField> <igtbl:BoundDataField Key="STUDENTNAME" DataFieldName="STUDENTNAME" Width="90%"></igtbl:BoundDataField> <igtbl:BoundDataField Key="GRADE" DataFieldName="GRADE" Width="10%"></igtbl:BoundDataField> <igtbl:TemplateDataField Key="Delete" Width="20px"> <ItemTemplate> <asp:ImageButton ID="btnDelete" runat="server" CommandArgument="OFFENDERS" OnCommand="btnDelete_Command" ImageUrl="~/Images/Icons/Delete16.gif" ToolTip="Delete" OnClientClick="return confirm('Are you sure you want to delete this record?');" /> </ItemTemplate> </igtbl:TemplateDataField> </Columns> </igtbl:Band> <igtbl:Band Key="VICTIMS" AutoGenerateColumns="false" DataKeyFields="lngId,lngStudentId,lngFacultyStaffId"> <Columns> <igtbl:TemplateDataField Key="View" Width="20px" /> <igtbl:TemplateDataField Key="Edit" Width="20px" /> <igtbl:BoundDataField Key="STRNAME" DataFieldName="STRNAME" Width="90%"></igtbl:BoundDataField> <igtbl:BoundDataField Key="STRGRADE" DataFieldName="STRGRADE" Width="10%"></igtbl:BoundDataField> <igtbl:TemplateDataField Key="Delete" Width="20px"> <ItemTemplate> <asp:ImageButton ID="btnDelete" runat="server" CommandArgument="VICTIMS" OnCommand="btnDelete_Command" ImageUrl="~/Images/Icons/Delete16.gif" ToolTip="Delete" OnClientClick="return confirm('Are you sure you want to delete this record?');" /> </ItemTemplate> </igtbl:TemplateDataField> </Columns> <Bands> <igtbl:Band Key="VICTIMSCMMT" AutoGenerateColumns="false" DataKeyFields="lngId,lngStudentId,lngFacultyStaffId"> <Columns> <igtbl:BoundDataField Key="STRCOMMENT" DataFieldName="STRCOMMENT" Header-Text="Comment" Width="100%"></igtbl:BoundDataField> </Columns> <Behaviors> <igtbl:EditingCore BatchUpdating="true"> <Behaviors> <igtbl:CellEditing> <EditModeActions EnableOnActive="true" MouseClick="Single" /> <ColumnSettings> <igtbl:EditingColumnSetting ColumnKey="STRCOMMENT" ReadOnly="true" /> </ColumnSettings> </igtbl:CellEditing> </Behaviors> </igtbl:EditingCore> </Behaviors> </igtbl:Band> </Bands> <Behaviors> <igtbl:EditingCore BatchUpdating="true"> <Behaviors> <igtbl:CellEditing> <EditModeActions EnableOnActive="true" MouseClick="Single" /> <ColumnSettings> <igtbl:EditingColumnSetting ColumnKey="STRNAME" ReadOnly="true" /> <igtbl:EditingColumnSetting ColumnKey="STRGRADE" ReadOnly="true" /> </ColumnSettings> <CellEditingClientEvents EnteringEditMode="Grid_EnteringEditMode" /> </igtbl:CellEditing> </Behaviors> </igtbl:EditingCore> </Behaviors> </igtbl:Band> <igtbl:Band Key="WITNESSES" AutoGenerateColumns="false" DataKeyFields="lngId,lngStudentId,lngFacultyStaffId"> <Columns> <igtbl:TemplateDataField Key="View" Width="20px" /> <igtbl:TemplateDataField Key="Edit" Width="20px" /> <igtbl:BoundDataField Key="STRNAME" DataFieldName="STRNAME" Width="90%"></igtbl:BoundDataField> <igtbl:BoundDataField Key="STRGRADE" DataFieldName="STRGRADE" Width="10%"></igtbl:BoundDataField> <igtbl:TemplateDataField Key="Delete" Width="20px"> <ItemTemplate> <asp:ImageButton ID="btnDelete" runat="server" CommandArgument="WITNESSES" OnCommand="btnDelete_Command" ImageUrl="~/Images/Icons/Delete16.gif" ToolTip="Delete" OnClientClick="return confirm('Are you sure you want to delete this record?');" /> </ItemTemplate> </igtbl:TemplateDataField> </Columns> <Bands> <igtbl:Band Key="WITNESSESCMMT" AutoGenerateColumns="false" DataKeyFields="lngId,lngStudentId,lngFacultyStaffId"> <Columns> <igtbl:BoundDataField Key="STRCOMMENT" DataFieldName="STRCOMMENT" Header-Text="Comment" Width="100%"></igtbl:BoundDataField> </Columns> <Behaviors> <igtbl:EditingCore BatchUpdating="true"> <Behaviors> <igtbl:CellEditing> <EditModeActions EnableOnActive="true" MouseClick="Single" /> <ColumnSettings> <igtbl:EditingColumnSetting ColumnKey="STRCOMMENT" ReadOnly="true" /> </ColumnSettings> </igtbl:CellEditing> </Behaviors> </igtbl:EditingCore> </Behaviors> </igtbl:Band> </Bands> <Behaviors> <igtbl:EditingCore BatchUpdating="true"> <Behaviors> <igtbl:CellEditing> <EditModeActions EnableOnActive="true" MouseClick="Single" /> <ColumnSettings> <igtbl:EditingColumnSetting ColumnKey="STRNAME" ReadOnly="true" /> <igtbl:EditingColumnSetting ColumnKey="STRGRADE" ReadOnly="true" /> </ColumnSettings> <CellEditingClientEvents EnteringEditMode="Grid_EnteringEditMode" /> </igtbl:CellEditing> </Behaviors> </igtbl:EditingCore> </Behaviors> </igtbl:Band> </Bands> <Behaviors> <igtbl:Activation /> </Behaviors> </igtbl:WebHierarchicalDataGrid>
--------------------End-------------------------------------
On Code behind:
--------------------Begin-------------------------------------
Me.DEPA.Rows.Clear() Me.DEPA.DataSource = dsDataSet Me.DEPA.GridView.DataMember = "DisciplineEventParticipants" Me.DEPA.Bands.Item(0).DataMember = "DisciplineEventPrepetrators" Me.DEPA.Bands.Item(1).DataMember = "DisciplineEventVictimWitness" Me.DEPA.Bands.Item(2).DataMember = "DisciplineEventVictimWitness" Me.DEPA.Bands.Item(1).Bands.Item(0).DataMember = "DisciplineEventVictimWitness" Me.DEPA.Bands.Item(2).Bands.Item(0).DataMember = "DisciplineEventVictimWitness" Me.DEPA.DataBind()
-------------------End--------------------------------------
Additional Info:
Quick reply will be appreciated..!!
--
Greetings
Abhishek
I am using build 13.2.20132.2028, developing using IE 10.
The project was built originally with the UltraWebGrid and the task is to convert it to use WebHierarchicalDataGrid.
Given the size of the project, it would be difficult to pull out a working sample. But I will attach snippets that I hope will describe the issue.
I have a class, QueryResults, that extends the WHDG. Bands and columns are created in code; summaries are also added depending on configuration.
When I run with data that creates multiple pages in the grid AND adds one or more summary values, the grid displays nicely at first, and will respond properly the first time I switch to another page, but will always crash the second time I change the page, regardless of which pages I go to.
In ascx:
<cc2:QueryResults ID="QueryResults1" runat="server" Width="820px" Height="728px" SelectAllText="" AutoGenerateBands="False" AutoGenerateColumns="False" ongroupedcolumnschanged="QueryResults1_GroupColumn" BackColor="#FFFF99" DefaultColumnWidth="150px" EnableAjax="False" onload="QueryResults1_Load" oncalculatecustomsummary="QueryResults1_CalculateCustomSummary" SelectNoneText=""> <GroupingSettings EnableColumnGrouping="True"> </GroupingSettings> <Behaviors> <ig:ColumnMoving> </ig:ColumnMoving> <ig:Selection> </ig:Selection> <ig:Paging PagerMode="Numeric"> </ig:Paging> <ig:ColumnResizing> </ig:ColumnResizing> <ig:SummaryRow Enabled="False" EnableInheritance="True"> </ig:SummaryRow> </Behaviors> </cc2:QueryResults>
Summaries are added in OnInitializeBand:
public partial class QueryResults : Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid
protected override void OnInitializeBand(BandEventArgs e)
{
base.OnInitializeBand(e);
if (band.Behaviors.SummaryRow.ColumnSummaries.Count == 0)
// Add Total if a summary currently doesn't exist for a column
for (int i = 0; i < band.Columns.Count; i++)
// add total footer to first visible column
if (!band.Columns[i].Hidden)
ColumnSummaryInfo csit = new ColumnSummaryInfo();
csit.ColumnKey = band.Columns[i].Key;
Summary s = new Summary();
s.SummaryType = SummaryType.Custom;
s.CustomSummaryName = "Totals";
csit.Summaries.Add(s);
band.Behaviors.SummaryRow.ColumnSummaries.Add(csit);
break;
}
band.Behaviors.SummaryRow.Enabled = true;
band.Behaviors.SummaryRow.EnableInheritance = true;
band.Behaviors.SummaryRow.ShowSummariesButtons = false;
band.Behaviors.SummaryRow.FormatString = "{1}";
band.Behaviors.SummaryRow.EmptyFooterText = " ";
//TODO band.Behaviors.SummaryRow.SummariesCssClass = "";
ColumnSummaryInfo csi = new ColumnSummaryInfo();
csi.ColumnKey = band.Columns[index].Key;
csi.Summaries.Add(SummaryType.Sum);
band.Behaviors.SummaryRow.ColumnSummaries.Add(csi);
this.RefreshBehaviors();
The original page load binds the data:
DataTable dt = (DataTable)queryResultData;
this.GridView.ClearDataSource();
this.DataMember = dt.TableName;
this.DataKeyFields = keyList;
this.Columns.Clear();
foreach (DataColumn dc in dt.Columns)
if (dc.ColumnName != this.DataKeyFields)
BoundDataField boundFld1 = new BoundDataField(true);
boundFld1.Key = dc.ColumnName;
boundFld1.Header.Text = dc.ColumnName;
boundFld1.DataFieldName = dc.ColumnName;
boundFld1.VisibleIndex = dt.Columns.IndexOf(dc);
this.Columns.Add(boundFld1);
this.DataSource = dt.DataSet;
this.DataBind();
Every post back rebinds the data:
public void PageData(object queryResultData)
Hello gregehr,
Thank you for your reply. Is it possible to share a working sample showing this behavior in order to allow me to examine the matter further ?
Have you managed to find the solution for this?
I am getting the same error message when selecting page number on the WHDG pager, but it seems to happen only when I have some row summaries turned on.
Hello Abishek,
Please do not hesitate to contact me with any updates regarding this matter.
In order to investigate this matter in more detail, a working sample illustrating the issue in practice and the product version used would be greatly appreciated. There seem to be no issues in the provided code, however please note that calling Rows.Clear() on each page load should not be necessary.
Please do not hesitate to contact me with any questions and updates regarding this matter.