hi all
i want to add a datasource to dropdownlist this dropdownlist is one of the column of gridview here i want to add a datasource to dropdownlist at dynamically without using the sqldatasource
(vs2008 and c#)
hi all
i want to add a datasource to dropdownlist this dropdownlist is one of the column of gridview here i want to add a datasource to dropdownlist at dynamically without using the sqldatasource
(vs2008 and c#)
You could implement the OnDataBinding event for the dropdownlist control in your grid. In the event you could assign the DataSource property and other attributes to whatever you like. Bind it to a List<YourObject>
even.
Doing it on the OnDataBinding event also allows you to customize the values in the ddl on the fly as well. So each row's ddl could have a different set of options available based on some other data in your row if you need that type of functionality.
Tons of flexability with the ASP.NET controls if the OnDataBinding method is used instead of the auto (easy mode) wire ups.
I do agree with kelsey... you should use onDataBinding event.
yes as it is in the itemtemplate so you wont get it directly for that you have to use findcontrol