Using objectdatasource and automated updates: receiving wrong parameters.

Discussion in 'ASP .Net' started by craigkenisston@hotmail.com, Feb 3, 2006.

  1. Guest

    I have a grid attached to an objectdatasource from which just one field
    is editable.
    For the update method I have a method with two parameters, the key of
    the record and the column to be updated.
    However, what's happening is that I am receiving an empty key of the
    record in my update method.

    <asp:BoundField DataField="Key" HeaderText="Key" ReadOnly="True"
    SortExpression="Key" />
    <asp:BoundField DataField="AcceptReject" HeaderText="AcceptReject"
    ReadOnly="False" SortExpression="AcceptReject" />

    I notice that I I set Readonly False for the key expression, the
    parameter is correctly received in the update method.
    So, why should I have it editable in order to work ?
    Is there any other way to take this parameters to the update method
    without having to put my key in edit mode ?
     
    , Feb 3, 2006
    #1
    1. Advertising

  2. Craig,

    Have you set the datakeynames property of the grid?

    After setting it I retrieve my key from the gridview using the row's index:

    Dim ItemId As Int32 =
    CType(GridView1.DataKeys.Item(GridViewRow.RowIndex).Value, Int32)



    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    <> wrote in message
    news:...
    >I have a grid attached to an objectdatasource from which just one field
    > is editable.
    > For the update method I have a method with two parameters, the key of
    > the record and the column to be updated.
    > However, what's happening is that I am receiving an empty key of the
    > record in my update method.
    >
    > <asp:BoundField DataField="Key" HeaderText="Key" ReadOnly="True"
    > SortExpression="Key" />
    > <asp:BoundField DataField="AcceptReject" HeaderText="AcceptReject"
    > ReadOnly="False" SortExpression="AcceptReject" />
    >
    > I notice that I I set Readonly False for the key expression, the
    > parameter is correctly received in the update method.
    > So, why should I have it editable in order to work ?
    > Is there any other way to take this parameters to the update method
    > without having to put my key in edit mode ?
    >
     
    S. Justin Gengo [MCP], Feb 4, 2006
    #2
    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. Jeff
    Replies:
    1
    Views:
    372
    Tapio Kulmala
    Dec 2, 2005
  2. =?Utf-8?B?bXRob21hc29u?=

    ObjectDataSource won't perform updates

    =?Utf-8?B?bXRob21hc29u?=, Dec 15, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,837
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Dec 17, 2005
  3. tshad
    Replies:
    0
    Views:
    491
    tshad
    Feb 4, 2010
  4. David Thielen

    ObjectDataSource method as another ObjectDataSource

    David Thielen, Mar 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    246
    Steven Cheng[MSFT]
    Mar 23, 2006
  5. Kiki

    "Automated" updates..

    Kiki, Jun 5, 2006, in forum: Javascript
    Replies:
    5
    Views:
    94
Loading...

Share This Page