here's the situation: I created a datamodel in SQL-Server with entities like "players" and "teams" and "players in teams" (many-to-many between players and treams) and so on. I created an c# asp.net 4 entity framework, and it works fine.
Now I would like to have read-only reports like a "teamlist" with coaches address and players e-mail... Therefor I created a quite complex view in SQL-Server. This view is recognized correctly in VS 2010-EF. I created a subpage called "reports.aspx" referenced
by "default.aspx". The problem is, that the teamlist-view appears as a normal table in the "Menu1"-gridview in default.aspx. So I hide this table using Steve Naughtons security framework.
And this is the question: How can I bind my own gridview to an existing entity? How do I define the datasource? Where is the connection string? Do you know any example-code for this?
Yes, I am talking about the List Page. The problem is that the entities are editable tables, that represent my master data. The Reports are just read-only subviews, each with his own layout. Example: for the german basketball federation you need predefined
forms for team registration. They don't belong to the List page! So I would like to create a complete separated "reports"-page.
Tillmann
Member
19 Points
16 Posts
Separate Table From Scaffolding - Creating Own Grid From EF
May 09, 2012 07:55 AM|LINK
Hello,
here's the situation: I created a datamodel in SQL-Server with entities like "players" and "teams" and "players in teams" (many-to-many between players and treams) and so on. I created an c# asp.net 4 entity framework, and it works fine.
Now I would like to have read-only reports like a "teamlist" with coaches address and players e-mail... Therefor I created a quite complex view in SQL-Server. This view is recognized correctly in VS 2010-EF. I created a subpage called "reports.aspx" referenced by "default.aspx". The problem is, that the teamlist-view appears as a normal table in the "Menu1"-gridview in default.aspx. So I hide this table using Steve Naughtons security framework.
And this is the question: How can I bind my own gridview to an existing entity? How do I define the datasource? Where is the connection string? Do you know any example-code for this?
Thanks in advance & Regards
Tillmann
sjnaughton
All-Star
27320 Points
5459 Posts
MVP
Re: Separate Table From Scaffolding - Creating Own Grid From EF
May 09, 2012 08:22 AM|LINK
Hi Tillmann, not sure why you don't want the default grid to be displayed? I am assuming you are talking about the List page?
Always seeking an elegant solution.
Tillmann
Member
19 Points
16 Posts
Re: Separate Table From Scaffolding - Creating Own Grid From EF
May 09, 2012 08:33 AM|LINK
Hi Steve,
Yes, I am talking about the List Page. The problem is that the entities are editable tables, that represent my master data. The Reports are just read-only subviews, each with his own layout. Example: for the german basketball federation you need predefined forms for team registration. They don't belong to the List page! So I would like to create a complete separated "reports"-page.
Do you understand what I mean?
Regards
Tillmann
sjnaughton
All-Star
27320 Points
5459 Posts
MVP
Re: Separate Table From Scaffolding - Creating Own Grid From EF
May 09, 2012 11:37 AM|LINK
set the table to read only using the ReadOnly attribute in your metadata, normally Views come in read only.
Always seeking an elegant solution.
Tillmann
Member
19 Points
16 Posts
Re: Separate Table From Scaffolding - Creating Own Grid From EF
May 10, 2012 09:33 AM|LINK
OK, the answer is quite simple: use EntityDataSource and bind it to a GridView.
Sorry, I am quite new to this stuff...
Regards
Tillmann
sjnaughton
All-Star
27320 Points
5459 Posts
MVP
Re: Separate Table From Scaffolding - Creating Own Grid From EF
May 10, 2012 10:28 AM|LINK
Hi Tillmann, it is still possible to show the view in the stadard page with out going custom byt making it read only :)
Always seeking an elegant solution.
Tillmann
Member
19 Points
16 Posts
Re: Separate Table From Scaffolding - Creating Own Grid From EF
May 10, 2012 10:48 AM|LINK