代码:
DataSet ds = _dalEquipmentwiseCheckList.getEquipmentName();
ddEquipmentName.DataSource = ds.Tables[0].DefaultView;
ddEquipmentName.DataTextField = ds.Tables[0].Columns[1].ToString();
ddEquipmentName.DataValueField = ds.Tables[0].Columns[0].ToString();
ddEquipmentName.DataBind();
我想要的是:在 GridView 中选择一行时,应在下拉列表中选择相应的设备名称:
var selectRow = MyGridView.SelectedRow;
ddEquipmentName.SelectedValue = selectRow.Cells[2].Text;
****//this is giving me error****