how to bind dropdownlist which is inside repeater?
On your Repeater's ItemDatabound
event use the following:
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
((DropDownList)e.Item.FindControl("drp_CompPropAddress")).DataSource =(DataRowView) e.Item.DataItem;//Or any other datasource.
((DropDownList)e.Item.FindControl("drp_CompPropAddress")).DataBind();
}
Use the ItemDataBound event of the Repeater, like this:
protected void rep_UnAssignComps_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
DropDownList selectList = e.Item.FindControl("drp_CompPropAddress") as DropDownList;
if (selectList != null)
{
selectList.DataSource = SomeDataSource(); //your datasource
selectList.DataBind();
//selectList.DataTextField = "SomeColumn";
//selectList.DataValueField = "SomeID";
}
}
Also remember to set the DataTextField and DataValueField properties, either in the markup or in the ItemDataBound event.