每个房间的我将Button放在gridview中,当我点击每个Button我要弹出下拉列表时,在该下拉列表值中将退出数据库。每个房间的课程分配我上面提到的。 所以当我点击按钮显示下拉列表时,选择课程当然要进入gridview的partiuclar房间。 我怎么能用csharp。 Rgds, Narasiman P.In database records as follows Room Course 11 EFA 12 RFA 13 MFA 14 ROC Gridview as follows Room Course 11 Button1 12 Button2 13 Button3 14 Button4 for each room i place the Button inside the gridview, when i click the each Button i want to pop up the dropdownlist,in that dropdownlist values are to be retireved from the database. for each room course are assigned that i mentioned as above.so when i click the button display the dropdownlist,select the course that course to be postion into the partiuclar room in the gridview.for that how can i do using csharp.Rgds,Narasiman P.推荐答案试试这个try thisprivate void dataGridView1_CellClick_1(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataGridView1.Columns["Column2"].Index && e.RowIndex >= 0) { //MessageBox.Show(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); OleDbConnection con=new OleDbConnection("YourConnectionString"); string str = "select * course from YourTableName where room='" + dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString() + "'"; OleDbCommand cmd = new OleDbCommand(str, con); OleDbDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { dr.Read(); MessageBox.Show(dr[0].ToString()); } } } 这篇关于当我点击按钮时,下拉列表将显示在gridview中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-22 23:53
查看更多