日期:2014-05-17 浏览次数:20515 次
<dx:GridViewDataComboBoxColumn Caption="带班老师" VisibleIndex="3" FieldName="gangerTeacher" > <PropertiesComboBox ValueType="System.String"> </PropertiesComboBox> </dx:GridViewDataComboBoxColumn>
protected void CoursesDetailsGV_CellEditorInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgs e) { if(CoursesDetailsGV.IsEditing) { if (e.Column.FieldName == "gangerTeacher") { ASPxComboBox combo = e.Editor as ASPxComboBox; combo.ID = "gangerTeacherDdl11"; combo.TextField = "englishName"; combo.ValueField = "chineseName"; DataTable tempdt = Employees.GetEmployeeName(1).Tables[0]; DataRow tempdr = tempdt.NewRow(); tempdr["englishName"] = " "; tempdr["chineseName"] = " "; tempdt.Rows.Add(tempdr); combo.DataSource = tempdt; combo.DataBind(); } }
protected void CoursesDetailsGV_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { int singleCount=Convert.ToInt16(e.NewValues["singleCount"]); string singleTime = Convert.ToString(e.NewValues["singleTime"]); string gangerTeacher1 = Convert.ToString(e.NewValues["gangerTeacher"]); string gangerTeacher2 = Convert.ToString(e.OldValues["gangerTeacher"]); string gangerTeacher3 = Convert.ToString(e.Keys["gangerTeacher"]); string gangerTeacher = (CoursesDetailsGV.FindControl("gangerTeacherDdl11") as ASPxComboBox).Text; string foreignTeacher = (CoursesDetailsGV.FindControl("foreignTeacherDdl") as ASPxComboBox).Text; DataTable dt = (DataTable)ViewState["dt"]; e.Cancel = true; CoursesDetailsGV.CancelEdit(); }