Hi,
I'm having a problem with hierarchical datagrid using EntityDataSource . Hopefully its something very obvious that I've done wrong with this but I can't seem to find the issue so far.
I have used this demo as the basis for a hierarchical grid below and substituted in my own EntityDataSource datasources as required.
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarativerelations/defaultcs.aspx
Also I've been looking at this
http://www.telerik.com/help/aspnet-ajax/grid-binding-to-declarative-datasource-controls.html
The two entity datasources are effectively doctors referrals and any associated attached files. The referrals table is linked to the attachments table by foreign key (0,1 to many). The basic flow of operation should be that a referral can be created without any attachments. Attachments can be added to a referral at time of creation or at a later point.
Each attachment has a Referralid field which relates to the id field of the Referral table.
So based on this the master table should be.
<MasterTableView DataSourceID="EntityDataSourceReferrals" DataKeyNames="ID" AllowMultiColumnSorting="True">
The detailsview table should be related based on the below, Mastertable id is related to the REFERRALID of the attachment table (detailsview).
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="REFERRALID" MasterKeyField="ID">
</telerik:GridRelationFields>
</ParentTableRelation>
When I run the below code I get a result where the referrals show all attachments instead of showing only those attached to the referrals .
(Incorrect as Referral 1 has one attachment, referral 2 has no attachments)
Referral 1
...............=> Attachment (Referralid 1)
Referral 2
............... => Attachment (Referralid 1)
Whereas the correct result should be
Referral 1
...............=> Attachment (Referralid 1)
Referral 2
............... => No attachments
Any pointers as to where I'm going wrong here would be welcome.
Thanks.
I'm having a problem with hierarchical datagrid using EntityDataSource . Hopefully its something very obvious that I've done wrong with this but I can't seem to find the issue so far.
I have used this demo as the basis for a hierarchical grid below and substituted in my own EntityDataSource datasources as required.
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarativerelations/defaultcs.aspx
Also I've been looking at this
http://www.telerik.com/help/aspnet-ajax/grid-binding-to-declarative-datasource-controls.html
The two entity datasources are effectively doctors referrals and any associated attached files. The referrals table is linked to the attachments table by foreign key (0,1 to many). The basic flow of operation should be that a referral can be created without any attachments. Attachments can be added to a referral at time of creation or at a later point.
Each attachment has a Referralid field which relates to the id field of the Referral table.
So based on this the master table should be.
<MasterTableView DataSourceID="EntityDataSourceReferrals" DataKeyNames="ID" AllowMultiColumnSorting="True">
The detailsview table should be related based on the below, Mastertable id is related to the REFERRALID of the attachment table (detailsview).
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="REFERRALID" MasterKeyField="ID">
</telerik:GridRelationFields>
</ParentTableRelation>
When I run the below code I get a result where the referrals show all attachments instead of showing only those attached to the referrals .
(Incorrect as Referral 1 has one attachment, referral 2 has no attachments)
Referral 1
...............=> Attachment (Referralid 1)
Referral 2
............... => Attachment (Referralid 1)
Whereas the correct result should be
Referral 1
...............=> Attachment (Referralid 1)
Referral 2
............... => No attachments
Any pointers as to where I'm going wrong here would be welcome.
Thanks.
<%@ Page Language="c#" CodeBehind="testdetailsview.aspx.cs" Inherits="mWebPortal.test"%> <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>Declarative relations in hierarchical ASP.NET Grid | RadGrid Demo</title> </head> <body> <form id="form1a" runat="server"> <telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" /> <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" /> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadGrid ID="RadGrid1" ShowStatusBar="True" DataSourceID="EntityDataSourceReferrals" runat="server" PageSize="7" AllowSorting="True" AllowPaging="True" GridLines="None" CellSpacing="0"> <PagerStyle Mode="NumericPages"></PagerStyle> <MasterTableView DataSourceID="EntityDataSourceReferrals" DataKeyNames="ID" AllowMultiColumnSorting="True"> <DetailTables> <telerik:GridTableView DataKeyNames="REFERRALID" DataSourceID="EntityDataSourceRefAttachments" Width="100%" runat="server"> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="REFERRALID" MasterKeyField="ID"> </telerik:GridRelationFields> </ParentTableRelation> </telerik:GridTableView> </DetailTables> </MasterTableView> </telerik:RadGrid> <asp:EntityDataSource ID="EntityDataSourceReferrals" runat="server" ConnectionString="name=RefEntities" DefaultContainerName="RefEntities" EnableFlattening="False" EntitySetName="Referrals"> </asp:EntityDataSource> <asp:EntityDataSource ID="EntityDataSourceRefAttachments" runat="server" ConnectionString="name=RefEntities" DefaultContainerName="RefEntities" EnableFlattening="False" EntitySetName="ReferralAttachments" AutoGenerateWhereClause="True"> </asp:EntityDataSource> </form> </body></html>