GridView with ObjectDataSource

A

Andrew Jones

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
 
C

Chad Scharf

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top