Editing/Deleting/Inserting Records using ASPxGridView

Discussion in 'ASP .Net Web Controls' started by WebGuy, Oct 17, 2007.

  1. WebGuy

    WebGuy Guest

    I'm using Visual Studio 2005 and SQL Server 2005, and I've created an
    AJAXenabled ASPx.Net Website. In one of my SQL Server tables, I have Social
    Security Number as my PrimaryKey, and I'm using this field as a Seach
    parameter in my WebForm. My question is this ... Is it necessary to display
    the PrimaryKey in the ASPxGridView in order for you to be able to
    Edit/Update a record? When I include the PrimaryKey field in the
    ASPxGridView, I can Edit/Delete records, but if I don't include the
    PrimaryKey (or set it to Visible=False) then I can't Edit/Delete records.

    Thanks in advance for any advice/assistance offered.

    Shane
     
    WebGuy, Oct 17, 2007
    #1
    1. Advertisements

  2. WebGuy

    Manish Guest

    Hi,

    You can delete the records from the GridView even if you do not specify any
    Primary key in your Table but in that case your delete query would not be
    automatically generated by the sqldatasource.

    You will have to write your query yourself in the deleteQuery in the
    SQLDataSource and specify the DataKeyName property of the GridView to be one
    of the column of the table on the basis of which the row would be deleted
    from the table.

    Regards,
    Manish



    "WebGuy" wrote:

    > I'm using Visual Studio 2005 and SQL Server 2005, and I've created an
    > AJAXenabled ASPx.Net Website. In one of my SQL Server tables, I have Social
    > Security Number as my PrimaryKey, and I'm using this field as a Seach
    > parameter in my WebForm. My question is this ... Is it necessary to display
    > the PrimaryKey in the ASPxGridView in order for you to be able to
    > Edit/Update a record? When I include the PrimaryKey field in the
    > ASPxGridView, I can Edit/Delete records, but if I don't include the
    > PrimaryKey (or set it to Visible=False) then I can't Edit/Delete records.
    >
    > Thanks in advance for any advice/assistance offered.
    >
    > Shane
    >
    >
    >
     
    Manish, Oct 17, 2007
    #2
    1. Advertisements

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. naija naija
    Replies:
    0
    Views:
    598
    naija naija
    Sep 28, 2004
  2. =?Utf-8?B?UCBvZiBEaHVtcA==?=

    Problem (Inserting records into sql server 2000 using asp.net)

    =?Utf-8?B?UCBvZiBEaHVtcA==?=, Aug 18, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    761
    =?Utf-8?B?UCBvZiBEaHVtcA==?=
    Aug 18, 2005
  3. Patrick.O.Ige
    Replies:
    0
    Views:
    818
    Patrick.O.Ige
    Nov 3, 2005
  4. John
    Replies:
    1
    Views:
    459
  5. Harry Barker
    Replies:
    2
    Views:
    666
    Alf P. Steinbach
    Apr 19, 2006
  6. WebGuy
    Replies:
    1
    Views:
    1,052
    =?Utf-8?B?TWFuaXNo?=
    Oct 17, 2007
  7. Jas
    Replies:
    1
    Views:
    197
    Ray at
    Oct 14, 2003
  8. crea
    Replies:
    2
    Views:
    616
    Nobody
    Dec 28, 2012
Loading...