GUID key fields and GridView/DetailView

Discussion in 'ASP .Net' started by =?Utf-8?B?RWQgV2FycmVu?=, Apr 16, 2007.

  1. After working on this for the past three days!!

    1. I build a simple table in sql server 2005
    TestID (int, auto increment) (key)
    TestText (nvchar,10)

    2. In visual studio 2005, I build a simple dataset, using one tableadapter
    based on the test table, select both fields, and use the wizard to build the
    get, update,insert, delete queries.

    3. save and compile

    4. build a new web page, default.aspx

    5. add an objectdatasource based on the table adapter above

    6. add a GridView and link to the objectdatasource above

    7. Save and compile

    8. run

    9. It works!!!!

    10. Repeat all of the steps above with the ONLY difference that I set the
    key field (testID) to a replication type (GUID).

    IT FAILS with the error:

    "Could not find a property named 'TestText' on the type specified by the
    DataObjectTypeName property in ObjectDataSource 'ObjectDataSource1'"

    Question: Am I the only one that can't figure out why this is happening?

    What is going on here?

    It would appear that the Gridview does not properly handle the GUID object
    and I might need to do some string-->guid and/or guid--> string conversion.

    My problem is that I don't know where to do this (maybe in the onupdating
    event)

    The only work around I have found is to capture the returned values manually
    in the onupdating event of the GridView and manually pushing the data around.
    This goes against the grain of the IDE concept.

    Note: Changing the key type in my production database is just not an option!

    Ideas, experience -- please!!
    --
    Ed Warren
     
    =?Utf-8?B?RWQgV2FycmVu?=, Apr 16, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kha Tran
    Replies:
    0
    Views:
    554
    Kha Tran
    Jun 3, 2005
  2. Luqman
    Replies:
    0
    Views:
    336
    Luqman
    Feb 27, 2007
  3. Jeff
    Replies:
    1
    Views:
    841
    Konstantinos Pantos
    Apr 11, 2007
  4. Plissskin
    Replies:
    1
    Views:
    2,129
    Milosz Skalecki [MCAD]
    Jan 19, 2008
  5. Benedictum

    DropdownList fields in DetailView

    Benedictum, Apr 17, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    123
    Benedictum
    Apr 17, 2006
Loading...

Share This Page