//在Repeater中我是这样做的
protected void RptNew_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem)
{
DataRowView rowv = (DataRowView)e.Item.DataItem;
DropDownList DListNewsIsShow = (DropDownList)e.Item.FindControl("DListNewsIsShow");
DListNewsIsShow.Items.FindByValue(rowv["isshow"].ToString()).Selected = true;
//rowv["isshow"].ToString(),出版社
}
}
页面中使用绑定:把DropDownList的selectedValue属性定一下。
selectedValue='<%# Eval("PublisherId") %>'