ObjectContainerDataSource for DropDownList in FormView with Two-Way DataBinding

Aug 16, 2007 at 2:37 PM
Edited Aug 16, 2007 at 2:40 PM
Hi ,

I Have to Bind the Data to the DropDownList in Run Time in Asp (c#) , Using the "ObjectContainerDataSource" Which is in the "FormView", I tried with this code

DropDownList drop = (DropDownList)row.FindControl("DropDownList1");

drop.DataSource = ObjectContainerDataSource1;
drop.DataMember = "CatalogValueCollection";
drop.DataTextField = "Value";
drop.DataValueField = "Id";

But when I run this the DropDownList is not getting any Values, it is blank, Some time I am Getting the error's "Object references is not set to an Instances" . & "The Value field is not found",
The "ObjectContainerDataSource" is getting the data.
Is there any other way to do this in run time,

Thanks with regards
Anil S G