东方兄,我搞定了,看代码
发表于:2007-06-30来源:作者:点击数:
标签:
public void DataGrid1_Edit(object sender,DataGridCommandEventArgs e) { string strSql; string ConnectionString; ConnectionString = ConfigurationSettings.AppSettings[ConnectionString]; DataGrid1.EditItemIndex =(int)e.Item.ItemIndex; BindGrid(
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();
}
原文转自:http://www.ltesting.net