Welcome Guest Search | Active Topics | Sign In | Register

eo_Callback function is blanking my Grid Options
Greg
Posted: Wednesday, July 15, 2009 2:33:53 AM
Rank: Newbie
Groups: Member

Joined: 7/10/2009
Posts: 4
I have an EO Grid inside a callback panel. I also have a context menu wired up to the grid. If I call eo_callback from the context menu click handler the grid returns with no data after the callback. However, if I make the same call from the function which shows the context menu the data is still present after the callback. Does anyone know why this is happening. Thanks.


Below is the javascript

function ShowContextMenu(e, grid, item, cell)
{
//Save the target cell index
g_itemIndex = item.getIndex();
g_cellIndex = cell.getColIndex();

//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(param); //this call seems to work fine. The grid comes back with its data

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); //this call blanks the grid
}
}

function PostBackGrid(param)
{
//CallbackPanelDocGrid
//EOGridDocuments
eo_Callback('CallbackPanelDocGrid',param);
}

Code: JavaScript
Code: JavaScript
eo_support
Posted: Wednesday, July 15, 2009 8:24:46 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Your code looks fine to us. Is it possible for you to provide a full test page with both the .aspx file and your .cs/.vb file? You can change your data source to any empty array. For example:

Code: C#
EOGridDocuments.DataSource = new object[10];
EOGridDocuments.DataBind();


This should generates 10 empty rows for the Grid (if you have DataField set on the columns then you need to clear those). This way the code would run without your data source so that it's possible for us to run the code at here.

Thanks!
Greg
Posted: Wednesday, July 15, 2009 10:01:56 AM
Rank: Newbie
Groups: Member

Joined: 7/10/2009
Posts: 4
The code is housed on custom control that has a bunch of other logic. I will extract only the relevant part perform the above step and send it to you.

I did some more testing last night and it looks like the grids datasource property is being set to null after every postback. I am 99% sure I do not have any code in the page that is doing this. Is there any way just off the top of your head that this could happen? Thanks.
eo_support
Posted: Wednesday, July 15, 2009 10:08:46 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

This is normal. The Grid keeps its data, but it does not keep the DataSource object. When you call DataBind the Grid extracts all the data from your data souce object. After that it no longer has anything to do with your DataSource object. As a result, it is perfect normal that during every post back the Grid's DataSource is null. The data it extracted from your data source is still kept by the grid.

Thanks!
Greg
Posted: Wednesday, July 15, 2009 11:20:04 AM
Rank: Newbie
Groups: Member

Joined: 7/10/2009
Posts: 4
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
eo_support
Posted: Wednesday, July 15, 2009 11:48:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Thank you very much for the testing code. We were able to reproduce the error and have confirmed this to be a bug. We will fix it and provide you an update build as soon as possible.

Thanks!
eo_support
Posted: Wednesday, July 15, 2009 9:56:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We have posted a new build that fixed this issue. Please check your private message for download location.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.