entitydatasource

How to access data in EntityDataSource programmatically

心不动则不痛 提交于 2019-12-10 23:47:42
问题 I have an EntityDataSource bound to many filters used by gridview data, I want to have access to the entities that was selected be the EntityDataSource to be able to export them in xml for example, how can I do that? 回答1: You get access to result of query executed in EntityDataSource by handling its Selected event and accessing Results of EntityDataSourceSelectedEventArgs . 来源: https://stackoverflow.com/questions/9565591/how-to-access-data-in-entitydatasource-programmatically

Sorting a bound ASP.NET GridView on the Count of items in an Entity Framework navigation property

感情迁移 提交于 2019-12-10 17:09:57
问题 I have an ASP.NET page with a GridView control bound to an EntityDataSource (see simplified code below). The grid is showing a list of Parent items and includes a column to show the .Count of Children for this parent. I can get the grid to show the count properly, but I can't figure out what to use for the asp:TemplateField SortExpression value to be able to set the sort to the count of children. Here is what my code looks like (simplified for clarity)... <asp:EntityDataSource ID=

Filter Data using EntityDataSource

Deadly 提交于 2019-12-01 05:19:56
问题 I use EF 4, C# and MS Membership Provider. I have a GridView with DataSource an EntityDataSource web control. I would like filter Data using EntityDataSource, filter show apply for the Current Logged-In User, this value should be taken using MS Memebership Provider ( Membership.GetUser(); ). Now I cannot inf any Parameter in EntityDataSource that would allow me to dot that (in Where/Automatically generate a Where expression using provided parameter ). Do you have any ideas? Please provide me

Visual Studio 2013 and Entity Framework

拥有回忆 提交于 2019-11-30 20:49:58
I'm using VS 2013 and SQL Svr 2012 and trying use EF to populate a gridview. As this is a very simple test, I have just one table with a key and a couple of data fields. The process of creating the model seems to work fine - it shows as expected in the designer view, the files are created in app_code, a bin folder is created with 2 dlls, and the config file is updated with a connection string and other entries. When I try to select the "named connection" I get the error "Unable to load the specified metadata resource" and it talks about rebuilding the project to get the assemblies. I've spent

Entity DataSource not working with Entity Framework 6 Upgrade

扶醉桌前 提交于 2019-11-27 23:53:48
I recently upgraded our Webforms application from EF 4.4 to EF6 and I got so many compile time build errors with the Entity Datasource controls. Generally I am getting these error in all occurrences when trying to access the context object : e.Context I have followed the same walkthrough as given in : http://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20EF6 The error information which is showing up is: 1) Module System.Data.Entity. version="4.0.0.0" should be referenced 2) Cannot case expression of type System.Data.Objects.ObjectContext to type ObjectContext

Entity DataSource not working with Entity Framework 6 Upgrade

拟墨画扇 提交于 2019-11-26 23:24:36
问题 I recently upgraded our Webforms application from EF 4.4 to EF6 and I got so many compile time build errors with the Entity Datasource controls. Generally I am getting these error in all occurrences when trying to access the context object : e.Context I have followed the same walkthrough as given in : http://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20EF6 The error information which is showing up is: 1) Module System.Data.Entity. version="4.0.0.0" should

Convert DBContext to ObjectContext for use with GridView

ぐ巨炮叔叔 提交于 2019-11-26 11:01:20
问题 I have a webforms project using EF codefirst to persist data. I\'d like to use a GridView and EntityDataSource, in order to save writing CRUD. Is this possible? Can I convert my DBContext to an ObjectContext that is expected by the EntityDataSource? Here\'s what I tried: <asp:EntityDataSource ID=\"OrdersDataSource\" runat=\"server\" ContextTypeName=\"SomeNamespace.Models.ShopDBContext\" EnableFlattening=\"False\" EntitySetName=\"Orders\" EntityTypeFilter=\"Order\" EnableDelete=\"False\"