Hello AG,
For the DropDownList control, so far it hasn't provided a event like the
"ItemDataBound" event of DataGrid(or "RowDataBound" event of GridView
control). Therefore, it may be difficult to intercept the dataitem of
every listItem in DropDownList. However, as you're using the
ObjectDataSource, you can still have a look at the
ObjectDataSource.Selected event. In this event, the selected data(will be
bound to the target control) has been returned and you can access it
through this event's eventargument. e.g.
====================
protected void ObjectDataSource1_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
{
Response.Write("<br/>ReturnValue: " + e.ReturnValue);
}
=======================
so if your object datasource is returning a typed DataTable, the
"ReturnValue" above is just the typed datatable instance.
In addition, the ObjectDatasource also provides "ObjectCreated" event which
can help us get the reference to the underlying data access class
instance(configured in ObjectDataSource's TypeName). If you have some
certain methods on the class that can help do some custom functions, you
can get the referene and peform teh method call on it.
#ObjectDataSource.ObjectCreated Event
http://msdn2.microsoft.com/en-au/library/system.web.ui.webcontrols.objectdat
asource.objectcreated.aspx
Hope this also helps. If you have any further questions or any particular
requirement in your scenario, please feel free to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.