PDA

View Full Version : editing a view with gridview


danb84
05-19-2009, 02:05 PM
Hi everyone,

I've got a pretty simple view that just picks some fields from a table, and a subselect that picks parent data from the same table.

Here's the SQL query:

SELECT PageID, PageTitle, PageNavTitle, PageParentID, PagePriority,

(SELECT PageTitle
FROM dbo.Pages AS ParentPages
WHERE (PageID = dbo.Pages.PageParentID)) AS PageParentTitle


FROM dbo.Pages
WHERE (PagePublished = 'True') AND (PageDeleted = 'False')
ORDER BY PageParentID, PagePriority

I want to use this view as a datasource inside a gridview, but the options 'generate insert/update/delete statements' are disabled when you go to configure the datasource.

I have primary keys defined on the table, and the subselect doesn't reference any external tables... should this work or am I barking up the wrong tree?

Thanks from Newcastle, England
-Dan