Below is the code I am using. The data is definatly not being kept. Any time I select a row on than zero and click the context menu item I get the following error.
Server Error in '/' Application.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.Collections.ArrayList.get_Item(Int32 index) +2880797
EO.Web.GridCellCollection.get_Item(Int32 columnIndex) +30
EO.Web.Grid.a(Int32 A_0, Int32 A_1) +171
EO.Web.Internal.c7.a(h6 A_0) +717
EO.Web.Internal.bs.aa() +272
EO.Web.WebControlBase.a(Object A_0) +96
EO.Web.Grid.a(Object A_0) +28
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +186
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +136
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +224
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +136
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +224
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +136
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +224
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +136
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +224
System.Web.UI.Page.LoadAllState() +439
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1092
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
EO_TEST.ascx
Code: HTML/ASPX
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="EO_Test.ascx.vb" Inherits="DocApprovalTestSite.EO_Test" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<script type="text/javascript">
function ShowContextMenu(e, grid, item, cell)
{
//Save the target cell index
g_itemIndex = item.getIndex();
g_cellIndex = cell.getColIndex();
grid.selectItem(g_itemIndex);
//Show the context menu
var menu = eo_GetObject("<%=ContextMenuDocuments.ClientID%>");
eo_ShowContextMenu(e, "<%=ContextMenuDocuments.ClientID%>");
//Return true to indicate that we have
//displayed a context menu
//PostBackGrid('test');
return true;
}
function OnContextMenuClick(e, eventInfo)
{
//var cbPanel = eo_GetObject('<=CallbackPanelDocGrid.ClientID>');
var grid = eo_GetObject("<%=EOGridDocuments.ClientID%>");
var item = eventInfo.getItem();
var gridItem = grid.getItem(g_itemIndex);
var param = gridItem.getKey();
if (item.getText()=="Download Document")
{
PostBackGrid(param);
}
}
function PostBackGrid(param)
{
//CallbackPanelDocGrid
//EOGridDocuments
eo_Callback('CallbackPanelDocGrid',param);
}
</script>
<fieldset style="width: 812px">
<eo:CallbackPanel ID="CallbackPanelDocGrid" runat="server">
<legend><span style="font-size: 10pt; font-family: Verdana">Documents</span></legend>
<eo:Grid ID="EOGridDocuments" runat="server" BorderColor="#7F9DB9" BorderWidth="1px"
ColumnHeaderAscImage="00050104" ColumnHeaderDescImage="00050105" ColumnHeaderDividerImage="00050103"
FixedColumnCount="1" Font-Bold="False" Font-Italic="False" Font-Names="Tahoma"
Font-Overline="False" Font-Size="8.75pt" Font-Strikeout="False" Font-Underline="False"
GoToBoxVisible="True" GridLineColor="220, 223, 228" GridLines="Both" Height="200px"
Width="800px" AllowColumnReorder="True" AllowPaging="True" ClientSideOnContextMenu="ShowContextMenu"
KeyField="ID" LoadingHTML="Loading...">
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
<ItemStyles>
<eo:GridItemStyleSet>
<ItemStyle CssText="background-color: white" />
<ItemHoverStyle CssText="background-color: whitesmoke" />
<SelectedStyle CssText="background-color: #316ac5; color: white" />
<FixedColumnCellStyle CssText="border-right: #d6d2c2 1px solid; padding-right: 10px; border-top: #faf9f4 1px solid; border-left: #faf9f4 1px solid; border-bottom: #d6d2c2 1px solid; background-color: #ebeadb; text-align: right; color: black;" />
<CellStyle CssText="padding-left:8px;padding-top:2px;white-space:nowrap;" />
</eo:GridItemStyleSet>
</ItemStyles>
<ContentPaneStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;" />
<GoToBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; BORDER-LEFT: #7f9db9 1px solid; WIDTH: 40px; BORDER-BOTTOM: #7f9db9 1px solid" />
<Columns>
<eo:RowNumberColumn Width="25">
</eo:RowNumberColumn>
<eo:StaticColumn DataField="" HeaderText="Name">
</eo:StaticColumn>
<eo:StaticColumn DataField="" HeaderText="Description" Width="250">
</eo:StaticColumn>
<eo:StaticColumn DataField="" HeaderText="Type">
</eo:StaticColumn>
<eo:StaticColumn DataField="" HeaderText="Owner" Width="200">
</eo:StaticColumn>
<eo:StaticColumn DataField="" HeaderText="Time Created">
</eo:StaticColumn>
</Columns>
<ColumnHeaderStyle CssText="background-image:url('00050101');padding-left:8px;padding-top:3px;" />
</eo:Grid>
</eo:CallbackPanel>
<eo:ContextMenu ID="ContextMenuDocuments" runat="server" CheckIconUrl="OfficeCheckIcon2"
ControlSkinID="None" Width="150px" RaisesServerEvent="True">
<LookItems>
<eo:MenuItem DisabledStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:5px;padding-right:5px;padding-top:1px;color:gray"
Height="24" HoverStyle-CssText="background-color:#C0D6F4;border-bottom-color:#000080;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#000080;border-left-style:solid;border-left-width:1px;border-right-color:#000080;border-right-style:solid;border-right-width:1px;border-top-color:#000080;border-top-style:solid;border-top-width:1px;padding-left:4px;padding-right:4px;padding-top:0px;padding-bottom:0px;"
ItemID="_TopLevelItem" NormalStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:5px;padding-right:5px;padding-top:1px;"
SelectedStyle-CssText="background-color:white;border-bottom-color:#000080;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#000080;border-left-style:solid;border-left-width:1px;border-right-color:#000080;border-right-style:solid;border-right-width:1px;border-top-color:#000080;border-top-style:solid;border-top-width:1px;padding-left:4px;padding-right:4px;padding-top:0px;padding-bottom:0px;">
<SubMenu CollapseEffect-Type="GlideTopToBottom" ExpandEffect-Type="GlideTopToBottom"
ItemSpacing="3" LeftIconCellWidth="25" SideImage="Office2003SideBar2" Style-CssText="background-color:#F6F6F6;border-bottom-color:#002D96;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#002D96;border-left-style:solid;border-left-width:1px;border-right-color:#002D96;border-right-style:solid;border-right-width:1px;border-top-color:#002D96;border-top-style:solid;border-top-width:1px;color:black;cursor:hand;font-family:Tahoma;font-size:8pt;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;">
</SubMenu>
</eo:MenuItem>
<eo:MenuItem IsSeparator="True" ItemID="_Separator" NormalStyle-CssText="background-color:#6a8ccb;height:1px;margin-left:30px;width:1px;">
</eo:MenuItem>
<eo:MenuItem DisabledStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:2px;padding-right:5px;padding-top:1px;color:gray"
Height="24" HoverStyle-CssText="background-color:#FFEEC2;border-bottom-color:#000080;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#000080;border-left-style:solid;border-left-width:1px;border-right-color:#000080;border-right-style:solid;border-right-width:1px;border-top-color:#000080;border-top-style:solid;border-top-width:1px;padding-left:1px;padding-right:4px;padding-top:0px;"
ItemID="_Default" NormalStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:2px;padding-right:5px;padding-top:1px;"
SelectedStyle-CssText="background-color:white;border-bottom-color:#000080;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#000080;border-left-style:solid;border-left-width:1px;border-right-color:#000080;border-right-style:solid;border-right-width:1px;border-top-color:#000080;border-top-style:solid;border-top-width:1px;padding-left:1px;padding-right:4px;padding-top:0px;"
Text-Padding-Right="30">
<SubMenu CollapseEffect-Type="GlideTopToBottom" ExpandEffect-Type="GlideTopToBottom"
ItemSpacing="3" LeftIconCellWidth="25" SideImage="Office2003SideBar2" Style-CssText="background-color:#F6F6F6;border-bottom-color:#002D96;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#002D96;border-left-style:solid;border-left-width:1px;border-right-color:#002D96;border-right-style:solid;border-right-width:1px;border-top-color:#002D96;border-top-style:solid;border-top-width:1px;color:black;cursor:hand;font-family:Tahoma;font-size:8pt;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;">
</SubMenu>
</eo:MenuItem>
</LookItems>
<TopGroup Style-CssText="background-color:#abc7f6;">
<Items>
<eo:MenuItem Text-Html="Download Document">
</eo:MenuItem>
<eo:MenuItem Text-Html="Delete Document">
</eo:MenuItem>
</Items>
</TopGroup>
</eo:ContextMenu>
<asp:Button ID="btnDownloadDocument" Style="visibility: hidden" runat="server" Text="Button" />
</fieldset>
EO_Test.ascx.vb
Code: Visual Basic.NET
Imports FlairdocsDomain.GenericDataAccess
Imports FlairdocsDomain
Partial Public Class EO_Test
Inherits System.Web.UI.UserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Not IsPostBack) Then
BindDocumentsGrid()
End If
End Sub
Public Sub BindDocumentsGrid()
EOGridDocuments.DataSource = New Integer() {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
EOGridDocuments.DataBind()
End Sub
End Class