Creating a gridview template field with dynamic data and Entity

Last post 06-01-2009 2:00 PM by ricka6. 1 replies.

Sort Posts:

  • Creating a gridview template field with dynamic data and Entity

    06-01-2009, 1:16 PM
    • Member
      6 point Member
    • nico73
    • Member since 06-01-2009, 4:05 PM
    • Posts 4

     Hi

    I am creating the back office for a web application with dynamic data and entity framework.

    Default dynamic data template is good to input basic data like names, int values, date, etc... but i am not so happy with the way many to many links are managed.

     For example: I have to create marketing operations. These operations concern one or more client types (VIP, registerd, etc..)

     If I keep the default dynamic data template, the user who wants to create an operation has to enter the information about the operation itself and then to navigate to the operation_ClientType page and enter the link betwwen the operation and the types of clients.

    I would like the user to be able to  insert and edit operations without having to navigate to another page so I am lookig for a solution here :)

    I tried to use the technique in this post :http://forums.asp.net/p/1301257/3202487.aspx#3202487  which consist in a gridview field template. I have to say this is a very sexy technique since I could use it in many other cases but I am struggling because it was made for the LINQ to SQL framework and I am using Entity.

    On top of that, I have another constraint : the primary key of all my link tables are an auto increment ID. So to continue with my example, my table

    Operation_ClientType is designe like this :

    Id (int) Primary key

    OperationId (int) Foreign key references (operation)

    ClientTypeId Foreign key references (ClientType)

    With a unique constraint on the couple ( OperationId,ClientTypeId)

     

    So finally I have two questions : 

    •  Is it possible to adapt the grid view template to make it usable with Entity
    • Is is a big of a problem to have an auto increment Id in the link table.

    I hope I explained my problem well enough and that someone can help me :)

    (Sorry about the bad english :) )

     

  • Re: Creating a gridview template field with dynamic data and Entity

    06-01-2009, 2:00 PM
    Answer
    • Contributor
      5,808 point Contributor
    • ricka6
    • Member since 06-25-2008, 6:04 PM
    • Redmond
    • Posts 936
    • AspNetTeam
      Moderator

    See  Working with Many-to-Many Data Relationships in Dynamic Data  -
    With the current version and current preview you need to use ScaffoldColumn(false) with EF Identities. With the Preview you can also use ReadOnly(true).

    Rick -ASP.Net UE MVC FAQ   Rick on MVC & Dynamic Data   
Page 1 of 1 (2 items)