locked
Using views rather than tables RRS feed

  • Question

  • User-1682676269 posted

    Hi there,

    I needed to get infomation from a couple of tables so I created a view and added that to my dbml file.

    All the pages have been routed to run using the ListDetails template (with a gridview and detailsview) but when I go to the page using the view it shows only the gridvew and no detailsview.

    Does anybody know why this is happening?

    Appreciate any help.

    Monday, December 8, 2008 11:56 PM

Answers

  • User-1005219520 posted

    You can't make a non-updateable view updateable on Dynamic Data. Updateable views is a fairly complex topic unrelated to Dynamic Data. You need to experment with your view in T-SQL and verify if they are updateable. Once you get an updateable view working on the server (in EM or SQL Management Studio for example) then you can move to to Dynamic Data. Even then you might have to drop down to the console mode level to sort out the problem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 9, 2008 7:00 PM

All replies

  • User187056398 posted

    Maybe there is no data to display.  Try adding the EmptyDataText property:

     

     <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" 
            EmptyDataText="No Data in DetailsView!">
     
    Tuesday, December 9, 2008 9:09 AM
  • User-330204900 posted

    I think all you need to do is add an PK identifier to the view in your model see this thread here: Re: Dynamic Data with views

    Tuesday, December 9, 2008 11:58 AM
  • Tuesday, December 9, 2008 1:22 PM
  • User-1682676269 posted

    I set all of the columns to PK= true (even though none of them actually are) and I set the autosync on all of the columns to 'OnInsert' .The detailsview shows and existing records are editable however new records can't be created.

    It says that the changes multiple base tables (I have taken columns from 5 different tables for the view that I'm using).

     Any ideas?

    Tuesday, December 9, 2008 6:35 PM
  • User-1005219520 posted

    You can't make a non-updateable view updateable on Dynamic Data. Updateable views is a fairly complex topic unrelated to Dynamic Data. You need to experment with your view in T-SQL and verify if they are updateable. Once you get an updateable view working on the server (in EM or SQL Management Studio for example) then you can move to to Dynamic Data. Even then you might have to drop down to the console mode level to sort out the problem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 9, 2008 7:00 PM