This is a migrated thread and some comments may be shown as answers.

Radgrid Master/Detail with ADO.Net entities gives Stackoverflow

1 Answer 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joost van B
Top achievements
Rank 1
Joost van B asked on 31 Oct 2009, 04:11 PM

Hi all,

I made a Master/detail page with 2 Radgrids (Persons and their Cars). When I start the page everything is ok. I get Persons and the Cars of the first person. After selecting the second row in the person grid (the row is clientside selectable and there is a postback with AJAX), I expect the cars of the second person, but I receive an error:

An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

It is impossible for me to debug this error.

Ì am using ADO.NET entities. When a person is selected in the first grid, the id of the person is passed to the EntityDataSourceCar Datasource with a Control parameter in the Where parameters. The first time works because of the default values...

Has anybody a clue? Downhere is the code of the aspx. The aspx.cs is empty.

Thanks in advance,
Joost



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %> 
 
<%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %> 
<!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></title>  
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" /> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
        <Scripts> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
        </Scripts> 
    </telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
     <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="rgPerson">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="rgPerson" /> 
                    <telerik:AjaxUpdatedControl ControlID="rgCars" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <div> 
        <telerik:RadGrid ID="rgPerson" runat="server" AllowFilteringByColumn="True" AllowPaging="True" 
            AllowSorting="True" DataSourceID="EntityDataSourcePerson" GridLines="None" AllowAutomaticDeletes="True" 
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateDeleteColumn="True" 
            AutoGenerateEditColumn="True" ShowGroupPanel="True">  
            <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">  
                <Selecting AllowRowSelect="true" /> 
            </ClientSettings> 
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="EntityDataSourcePerson" 
                CommandItemDisplay="Top" EditMode="PopUp">  
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="id" DataType="System.Int32" HeaderText="id" ReadOnly="True" 
                        SortExpression="id" UniqueName="id">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name" 
                        UniqueName="Name">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="City" HeaderText="City" SortExpression="City" 
                        UniqueName="City">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridDateTimeColumn DataField="Birthday" HeaderText="Birthday" SortExpression="Birthday" 
                        UniqueName="Birthday">  
                    </telerik:GridDateTimeColumn> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 
        <br /> 
        <telerik:RadGrid ID="rgCar" runat="server" AllowFilteringByColumn="True" AllowPaging="True" 
            AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" 
            AllowSorting="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" 
            DataSourceID="EntityDataSourceCar" GridLines="None">  
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="EntityDataSourceCar" 
                CommandItemDisplay="Top">  
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="id" DataType="System.Int32" HeaderText="id" ReadOnly="True" 
                        SortExpression="id" UniqueName="id">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="Brand" HeaderText="Brand" SortExpression="Brand" 
                        UniqueName="Brand">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="PlateNumber" HeaderText="PlateNumber" SortExpression="PlateNumber" 
                        UniqueName="PlateNumber">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="Color" HeaderText="Color" SortExpression="Color" 
                        UniqueName="Color">  
                    </telerik:GridBoundColumn> 
                      
                </Columns> 
            </MasterTableView> 
            <ClientSettings> 
                <Selecting AllowRowSelect="True" /> 
            </ClientSettings> 
        </telerik:RadGrid> 
        <asp:EntityDataSource ID="EntityDataSourcePerson" runat="server" ConnectionString="name=TestEntities" 
            DefaultContainerName="TestEntities" EnableDelete="True" EnableInsert="True" EnableUpdate="True" 
            EntitySetName="Person">  
        </asp:EntityDataSource> 
        <asp:EntityDataSource ID="EntityDataSourceCar" runat="server" ConnectionString="name=TestEntities" 
            DefaultContainerName="TestEntities" EnableDelete="True" EnableInsert="True" EnableUpdate="True" AutoGenerateWhereClause="true" 
            EntitySetName="Car">  
            <WhereParameters> 
                <asp:ControlParameter ControlID="rgPerson" DefaultValue="1" Name="Person.id" PropertyName="SelectedValue" 
                    Type="Int32" /> 
            </WhereParameters> 
        </asp:EntityDataSource> 
    </div> 
    </form> 
</body> 
</html> 
 

1 Answer, 1 is accepted

Sort by
0
Kiara
Top achievements
Rank 1
answered on 04 Nov 2009, 02:40 PM
Your code seems fine to me, but the exception says that your stack overflows with data. Debug your implementation and step in the methods that get executed to see what happens. You may also try the same scenario with Microsoft GridViews with Select buttons in their rows to see what happens.

Kiara
Tags
Grid
Asked by
Joost van B
Top achievements
Rank 1
Answers by
Kiara
Top achievements
Rank 1
Share this question
or