public void DataGrid1_Edit(object sender,DataGridCommandEventArgs e)
{
string strSql;
string ConnectionString;
ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];
DataGrid1.EditItemIndex =(int)e.Item.ItemIndex;
BindGrid();
DropDownList ddl = (DropDownList)(DataGrid1.Items[e.Item .ItemIndex].Cells [4].Controls [1]);
strSql = "select WorkState,ItemNumber from ASP_Temp";
OleDbConnection myconn=new OleDbConnection(ConnectionString );
OleDbCommand mycommand=new OleDbCommand (strSql,myconn);
myconn.Open();
OleDbDataReader myreader=mycommand.ExecuteReader();
ddl.DataSource =myreader;
ddl.DataTextField ="WorkState";
ddl.DataValueField = "ItemNumber";
ddl.DataBind ();
myreader.Close();
myconn.Close();
}
东方兄,我搞定了,看代码
80酷酷网 80kuku.com