GridView with ObjectDataSource

Discussion in 'ASP .Net' started by Andrew Jones, Jan 11, 2008.

  1. Andrew Jones

    Andrew Jones Guest

    If there is a better place to post this please let me know.

    I have a GridView whose Data is bound to an ObjectDataSource ( BLL - DAL ).
    When I click Edit on a Row in that GridView I want one of my edit template
    fields to fill a DropDownList based on a value from another column on that
    same row.
    That DropDownList is bound to a different ObjectDataSource that is within
    that EditTemplate.

    I am using the Selecting Event on that ObjectDataSource to set up the
    parameter so the datasource populated according, but I don't know where to
    get that value from the GridView Row that is being edited. There is an
    EditIndex on the GridView that represents the row I am editing, but the
    GridView at the time of this event is not populated and this particular
    Gridview has sorting enabled so I can't rely on the natural order of the
    datasource.

    Any Ideas?

    -AJ
     
    Andrew Jones, Jan 11, 2008
    #1
    1. Advertising

  2. Andrew Jones

    Chad Scharf Guest

    have you tried using a ControlParameter within your drop down's
    ObjectDataSource control pointing to another control in the EditItemTemplate
    that the drop down list is in? I have in the past added a HiddenField control
    to the same EditItemTemplate so that the NamingContainer will allow the
    ObjectDataSource, upon binding, to grab that value property as a parameter
    when selecting. For some reason this magically works when perfoming complex
    databinding such as this but I can never seem to recreate the behavior in the
    code-behind myself.

    --
    Chad Scharf
    _______________________________
    http://www.chadscharf.com


    "Andrew Jones" wrote:

    > If there is a better place to post this please let me know.
    >
    > I have a GridView whose Data is bound to an ObjectDataSource ( BLL - DAL ).
    > When I click Edit on a Row in that GridView I want one of my edit template
    > fields to fill a DropDownList based on a value from another column on that
    > same row.
    > That DropDownList is bound to a different ObjectDataSource that is within
    > that EditTemplate.
    >
    > I am using the Selecting Event on that ObjectDataSource to set up the
    > parameter so the datasource populated according, but I don't know where to
    > get that value from the GridView Row that is being edited. There is an
    > EditIndex on the GridView that represents the row I am editing, but the
    > GridView at the time of this event is not populated and this particular
    > Gridview has sorting enabled so I can't rely on the natural order of the
    > datasource.
    >
    > Any Ideas?
    >
    > -AJ
    >
    >
    >
    >
     
    Chad Scharf, Jan 14, 2008
    #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. Kha Tran
    Replies:
    0
    Views:
    573
    Kha Tran
    Jun 3, 2005
  2. Danny W

    GridView update with ObjectDataSource

    Danny W, Sep 8, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    3,086
    Danny W
    Sep 8, 2005
  3. family

    gridview, objectdatasource

    family, Dec 22, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    547
    family
    Dec 22, 2005
  4. =?Utf-8?B?Sm9obl9I?=
    Replies:
    1
    Views:
    2,792
    =?Utf-8?B?Sm9obl9I?=
    Jan 19, 2006
  5. David Thielen

    ObjectDataSource method as another ObjectDataSource

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

Share This Page