Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
UltraWebGrid OnDblClick Index was outside the bounds of the array. error
posted

When I double click on the row rather than an individual cell I get this exception:

[IndexOutOfRangeException: Index was outside the bounds of the array.]
   Infragistics.WebUI.UltraWebGrid.UltraWebGrid.RaisePostBackEvent(String eventArgument) +13535
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

It never even gets to my handler. Code is below:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<igtbl:UltraWebGrid ID="grdProducts" runat="server" Height="400px" Style

="left: -21px;

top: -4px"

 

Width="469px" OnDblClick

="grdProducts_DblClick">

 

 

<Bands

>

 

 

<igtbl:UltraGridBand

>

 

 

<AddNewRow View="NotSet" Visible

="NotSet">

 

 

</AddNewRow

>

 

 

</igtbl:UltraGridBand

>

 

 

</Bands

>

 

 

<DisplayLayout BorderCollapseDefault="Separate" Name="grdProducts" RowHeightDefault="20px" StationaryMargins

="Header"

 

 

StationaryMarginsOutlookGroupBy="True" TableLayout="Fixed" Version

="4.00">

 

 

<GroupByBox

>

 

 

<Style BackColor="ActiveBorder" BorderColor="Window"></Style

>

 

 

</GroupByBox

>

 

 

<ActivationObject BorderWidth="" BorderColor

="">

 

 

<BorderDetails WidthLeft="0px" WidthRight="0px"

/>

 

 

</ActivationObject

>

 

 

<FooterStyleDefault BackColor="LightGray" BorderStyle="Solid" BorderWidth

="1px">

 

 

<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px"

/>

 

 

</FooterStyleDefault

>

 

 

<RowStyleDefault BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size

="8pt">

 

 

<BorderDetails ColorLeft="White" ColorTop="White"

/>

 

 

<Padding Left="3px"

/>

 

 

</RowStyleDefault

>

 

 

<FilterOptionsDefault

>

 

 

<FilterHighlightRowStyle BackColor="#151C55" ForeColor

="White">

 

 

</FilterHighlightRowStyle

>

 

 

<FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="11px" Height

="300px">

 

 

<Padding Left="2px"

/>

 

 

</FilterDropDownStyle

>

 

 

</FilterOptionsDefault

>

 

 

<HeaderStyleDefault BackColor="LightGray" BorderStyle

="Solid">

 

 

<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px"

/>

 

 

</HeaderStyleDefault

>

 

 

<EditCellStyleDefault BorderStyle="None" BorderWidth

="0px">

 

 

</EditCellStyleDefault

>

 

 

<FrameStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt" Height="400px" Width

="469px">

 

 

</FrameStyle

>

 

 

<Pager

>

 

 

<Style BackColor="LightGray" BorderStyle="Solid" BorderWidth

="1px">

<

 

BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White"></

BorderDetails>

</

 

Style

>

 

 

</Pager

>

 

 

<AddNewBox

>

 

 

<Style BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid" BorderWidth

="1px">

<

 

BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White"></

BorderDetails>

</

 

Style

>

 

 

</AddNewBox

>

 

 

</DisplayLayout

>

 

 

</igtbl:UltraWebGrid><br

/>

 

 

 

 

protected void Page_Load(object sender, EventArgs e)

{

XmlDataSource1.Data =

BSHFactory.GetProductList();

grdProducts.DataSourceID =

"XmlDataSource1";

grdProducts.DataBind();

grdProducts.Columns[0].Hidden =

true;

grdProducts.Columns[1].CellStyle.TextOverflow = Infragistics.WebUI.UltraWebGrid.

TextOverflow.Ellipsis;

grdProducts.Columns[1].Width =

Unit.Pixel(150);

grdProducts.Columns[2].CellStyle.TextOverflow = Infragistics.WebUI.UltraWebGrid.

TextOverflow.Ellipsis;

grdProducts.Columns[2].Width =

Unit.Pixel(500);

grdProducts.Columns[3].Width =

Unit.Pixel(150);

 

grdProducts.Width =

Unit.Pixel(803);

 

foreach (UltraGridRow r in grdProducts.Rows)

{

r.Cells[3].TargetURL =

'@' + r.Cells[3].Text;

}

}

 

protected void grdProducts_DblClick(object sender, ClickEventArgs e)

{

 

if (e.Cell != null)

{

 

UltraGridRow row = e.Cell.Row;

 

Product p = BSHFactory.GetProduct(Int64.Parse(row.Cells[0].Text));

 

if (p != null)

{

lblMsg.Text = p.Description;

}

 

else

{

lblMsg.Text =

 

"Couldn't load product"

;

  • 28464
    posted

    Hello,

    As far as I can tell by looking at the code, it is a combined page lifecycle / databinding issue. Declarative datasources like XmlDataSource need to be set declaratively through the DataSourceID in the ASPX of the page, e.g.

    <igtbl:UltraWebGrid runat="server" ID="UltraWebGrid1" DataSourceID="XmlDataSource1" ... />

    This way, you will not need to explicitly bind the grid in Page_Load and i think this will address the issue.