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
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.
I downloaded the latest build and now it works just fine
Customers
>> Orders
>> Customers
>> Orders
....
I don't understand what you are asking me!!
sorry
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.
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
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.
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
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.
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
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.