Last post Nov 02, 2010 03:20 PM by mavricp
Mar 01, 2010 04:41 PM|Blicko|LINK
Hello all, here's a problem I've been trying to figure out an elegant solution for, but so far I'm coming up blank. I have a situation where I'd like to display view-only data and Dynamic Data together on the same page (without creating custom insert.aspx
and edit.aspx pages). I've been playing around with using a SQL view, so that it returns me both my view-only fields and my updateable fields as well. I'm having issues with the insert side of things, the edit page works quite well, and I know I'm going to
have to create custom delete logic. The major drawback to using a SQL view though is that to get it to behave you have to 'hack' the .edmx file, and I'm not sure I want to do that. So I guess what I'm asking is that has anyone had any success with this, or
should I just bite the bullet and create custom pages for the situation of having view-only data and Dynamic Data on the same page? For the record I'm using the Release Candidate version of VS, and my website is an "ASP.NET Dynamic Entities Web Site". Thanks!
Mar 02, 2010 03:07 AM|fashfaq|LINK
No! SQL View only use for view , you can not edit the data.
Mar 02, 2010 04:02 AM|sjnaughton|LINK
Hi Blicko, I'm not an EF expert yet, I would always use SPROCS for updating when using a view anyway and set all non editable fields as read only/DB generated.
Dynamic Data 4
Mar 02, 2010 08:17 AM|Blicko|LINK
That sounds good, what I'm trying to do is to render something like the following on my DD Edit & Insert pages:
Label1 view only field
Label3 Drop Down List
Label4 view only field
That's why I was leaning toward using a SQL view, using the logic I found here:
How to create an updateable view with ADO Entity Framework and with LINQ to SQL. That way I could return both the fields that were updateable and the ones that were view-only, and would get away without having to make custom edit & insert pages. I guess
all I have to do is to find out how to 'override' the Dynamic Data update & insert logic and use my own stored procedures in place of that. Thanks for the input!
Mar 02, 2010 09:06 AM|sjnaughton|LINK
You can do that by using Stored Proceudres see:
Stored Procedure Support (Entity Framework)
Using stored procedures with ADO.NET entity framework
Nov 02, 2010 03:20 PM|mavricp|LINK
I have a similar problem where I am able to display a sql view using dynamic data. I am planning to do insert/updates via sql stored procedures. But when I open up the edit page I am unable to get the drop down list to work.
For example, I have a Projects view that has these columns
ProjectStatusId is defined in another table ProjectStatus (ProjectStatusId, ProjectStatusName ..).
I would like to see a drop down list of the ProjectStatus table(ProjectStatusName) when I insert/update the view. Any ideas?