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

[Solved] RadGrid and DynamicData Entity Web Site

13 Answers 483 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Simone
Top achievements
Rank 1
Simone asked on 07 Nov 2008, 11:50 AM
Hello,

I'm trying to integrate your RadGrid control in a DynamicData Entity WebSite using the code I have downloaded from this Blog. In my Entity Model I have basically two Entity Sets: Orders and Customers from the Northwind database. Orders has a foreignkey on the parent table Customers. 

The Orders scaffold table should contain a navigation link to Customers Table. As a matter of fact the databind process fails returning the following exception:

exception

DataBinding: 'NorthwindModel.Orders' does not contain a property with the name 'Customers.CustomerID'.

stacktrace:
   at System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName)
   at System.Web.DynamicData.ModelProviders.TableProvider.EvaluateForeignKey(Object row, String foreignKeyName)
   at System.Web.DynamicData.MetaForeignKeyColumn.GetForeignKeyValues(Object row)
   at System.Web.DynamicData.MetaForeignKeyColumn.GetForeignKeyPath(String action, Object row, String path)
   at System.Web.DynamicData.FieldTemplateUserControl.get_ForeignKeyPath()
   at ForeignKeyField.GetNavigateUrl() in c:\Documents and Settings\Daniele\My Documents\Visual Studio 2008\Projects\DynamicDataRadGridTest\WebSite\DynamicData\FieldTemplates\ForeignKey.ascx.cs:line 59
   at ASP.dynamicdata_fieldtemplates_foreignkey_ascx.__DataBindingHyperLink1(Object sender, EventArgs e) in c:\Documents and Settings\Daniele\My Documents\Visual Studio 2008\Projects\DynamicDataRadGridTest\WebSite\DynamicData\FieldTemplates\ForeignKey.ascx:line 3
   at System.Web.UI.Control.OnDataBinding(EventArgs e)
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
   at System.Web.UI.Control.DataBind()
   at System.Web.UI.Control.DataBindChildren()

I have noticed two things:
1) the ForeignKeyField.FieldValue is null
2) the ForeignKeyField.Row is the Entity itself instead of an EntityDataSourceWrapper object

I could correct the first issue adding just a line of code in the Page_Load event handler of the ListDetails.aspx page
protected void Page_Load(object sender, EventArgs e)  
{  
    MetaTable table = GridDataSource.GetTable();  
    Title = table.DisplayName;  
 
    // Includes foreignKey Entities in the EntityDataSource  
    GridDataSource.Include = table.ForeignKeyColumnsNames;  
     
    //...  

but I didn't figure out how to solve the databind issue

Any help is appreciated :)

Kind regards,
Simone

EDIT: I have uploaded my test project here. I hope this will help you to reproduce my problem

13 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 11 Nov 2008, 11:47 AM
Hello Simone,

I've prepared a sample application which is working just fine using Dynamic Data Entity project with RadGrid.
The only file that is modified is /PageTemplates/ListDetails - to use RadGrid isntead of GridView.

Please find the attached project. To run it you need to copy the latest build of RadControls for ASP.NET AJAX into the bin folder.

I hope this helps.

Kind regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Simone
Top achievements
Rank 1
answered on 11 Nov 2008, 02:19 PM
Thanks for your help

I downloaded the latest build and now it works just fine

0
Albert
Top achievements
Rank 1
answered on 15 Dec 2008, 10:32 AM
Could you plz update the code to show heirarchy? Like
Customers
   >> Orders
        >> Customers
               >> Orders
 ....

0
Simone
Top achievements
Rank 1
answered on 17 Dec 2008, 09:30 AM
Hi,

I don't understand what you are asking me!!

0
Albert
Top achievements
Rank 1
answered on 17 Dec 2008, 09:35 AM
I was asking Nikolay >_>
0
Simone
Top achievements
Rank 1
answered on 17 Dec 2008, 09:48 AM
OK :)

sorry
0
Nikolay Rusev
Telerik team
answered on 22 Dec 2008, 12:41 PM
Hello Simone,

Attached to this post you will find an example of using hierarchy RadGrid in Dynamic Data Entity template.
Have in mind that this is not common scenario of using DynamicData template. To run the application you need to place latest version of Telerik.Web.UI into /bin folder.

I hope this helps.

Kind regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mahipal
Top achievements
Rank 1
answered on 04 Mar 2009, 08:48 PM
I would like to use the telerik RADGrid in a dynamic data entities website. Although I was able to run your samples provided in this thread, a lot of the features of the Grid are not available. Example: filtering by column, skins, grouping, etc. aren't available. Do you have an implementation of the RADGrid that supports all its features in the context of dynamic data website?

At a minimum, do you have a sample that implements the "Filter by Column" feature in a dynamic data website?

Currently I'm evaluating your RADGrid in the context of Dynamic data websites. Do you have any documentation on what features are supported? or how to expand the "DynamicRadGrid.cs" class (in your previous examples) to support these RADGrid native features?

Thanks a lot.

Regards,
Mahipal
0
Nikolay Rusev
Telerik team
answered on 09 Mar 2009, 10:41 AM
Hello Mahipal,

Basically you can use RadGrid in Dynamic Data as in usual WbSite project. The problem when use RadGrid bound to EntityDataSource is that filter parameters are applied on the data source. Thus you will need to set

GridDataSource.AutoGenerateWhereClause=false

to have filtering enabled.

For your convenience I've prepared sample application. You can find it attached to this post.

Kind regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Robert Daggar
Top achievements
Rank 1
answered on 12 Nov 2009, 01:38 AM
Hi,

It seems the example DynamicDataEntity_1LevelHierarchy.zip does not work. When I tried to get http://localhost:1781/DynamicDataEntity_Test/Customers/Orders/ListDetails.aspx work, there is "HTTP Error 404 - Not Found."

Any help is appreciated :)

Kind regards,

Bill
0
Nikolay Rusev
Telerik team
answered on 13 Nov 2009, 02:46 PM
Hello Robert,

Change the navigation url of both hyper links to point proper application path. For example:

/default.aspx.cs/
1.<asp:HyperLink ID="HyperLink1" runat="server" 
2.        NavigateUrl='<%#Request.ApplicationPath + "/Customers/Orders/ListDetails.aspx"%>'>
3.    Customers->Orders</asp:HyperLink>
4.  
5.       <asp:HyperLink ID="HyperLink2" runat="server" 
6.        NavigateUrl='<%#Request.ApplicationPath +"/Orders/Customers/ListDetails.aspx"%>'>
7.    Orders->Customers</asp:HyperLink>

and in code behind call DataBind to page instead only of the menu(as it is by default).

Greetings,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Robert Daggar
Top achievements
Rank 1
answered on 14 Nov 2009, 08:41 PM

Hi Nikolay,

 

Thanks for your response. It is the navigation link problem. The example works now.

 

May I ask you another question? Is it possible that I use the  LINQ to SQL data model to replace the Entity Framework data model in this example? I trid it. Then, I used the LinqDataSource instead of EntityDataSource in ListDetail.aspx. However, it seems LinqDataSource class does not have the method "include", and the "OnSelecting event handler" does not work because I had to use the "LinqDataSourceSelectEventArgs" as the event argument type.

Kind Regards,

Bill

0
Nikolay Rusev
Telerik team
answered on 19 Nov 2009, 07:21 AM
Hello Robert,

inclide is EntityDataSource specific. If you need same scenario, but using LinqToSql  you can create new DynamicData application in Visual Studio and choosing LinqToSql template for DynamicData model.

Greetings,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Simone
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Simone
Top achievements
Rank 1
Albert
Top achievements
Rank 1
Mahipal
Top achievements
Rank 1
Robert Daggar
Top achievements
Rank 1
Share this question
or