Last post May 10, 2012 06:48 AM by Tillmann
May 09, 2012 03:55 AM|Tillmann|LINK
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
May 09, 2012 04:22 AM|sjnaughton|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?
May 09, 2012 04:33 AM|Tillmann|LINK
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?
May 09, 2012 07:37 AM|sjnaughton|LINK
set the table to read only using the ReadOnly attribute in your metadata, normally Views come in read only.
May 10, 2012 05:33 AM|Tillmann|LINK
OK, the answer is quite simple: use EntityDataSource and bind it to a GridView.
Sorry, I am quite new to this stuff...
May 10, 2012 06:28 AM|sjnaughton|LINK
Hi Tillmann, it is still possible to show the view in the stadard page with out going custom byt making it read only :)
May 10, 2012 06:48 AM|Tillmann|LINK