ItemDataBound事件里给他赋值,如下:
ItemDataBound(...)
{
if(e.Item.ItemType==ListItemType.EditItem)
{
//绑数据
SqlCommand rencommand=new SqlCommand("select DeptID,DeptName from Dept",BDConn);
SqlDataReader renreader=rencommand.ExecuteReader();
((DropDownList)e.Item.Cells[5].FindControl("DeptList")).DataSource=renreader;
((DropDownList)e.Item.Cells[5].FindControl("DeptList")).DataTextField="DeptName";
((DropDownList)e.Item.Cells[5].FindControl("DeptList")).DataValueField="DeptID";
((DropDownList)e.Item.Cells[5].FindControl("DeptList")).DataBind();
}