private void grdData_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { if (m_dsGridSource == null) { const string strBindGridSql = "SELECT 1 AS value , '排序1' AS Name UNION ALL SELECT 2 AS value , '排序2' AS NAME UNION ALL SELECT 3 AS value , '排序3' AS NAME UNION ALL SELECT 9 AS value , '排序9' AS NAME;SELECT 'gridcboSortnum '"; BindSourceHelper.BindClass bindClass = new BindSourceHelper.BindClass() { SqlType = SqlType.SqlServer, BindSql = strBindGridSql }; m_dsGridSource = BindSourceHelper.GetBindSourceDataSet(bindClass); } DataGridViewComboBoxCell gridcboSortnumCell = this.grdData.Rows[e.RowIndex].Cells[gridcboSortnum.Name] as DataGridViewComboBoxCell; ComboBoxHelper.BindDataGridViewComboBoxCell(gridcboSortnumCell, m_dsGridSource.Tables["gridcboSortnum"], "Name", "value"); }
private void grdData_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { if (m_dsGridSource == null) { const string strBindGridSql = "SELECT Name,value FROM [BseDictionary] WHERE ParentID=22;SELECT Name,value FROM [BseDictionary] WHERE ParentID=19;SELECT 'gridcboOnLevel ','gridcboCategory '"; BindClass bindClass = new BindClass() { SqlType = SqlType.SqlServer, BindSql = strBindGridSql }; m_dsGridSource = BindSourceHelper.GetBindSourceDataSet(bindClass, GlobalHelp.Conn); } DataGridViewComboBoxCell gridcboOnLevelCell = this.grdData.Rows[e.RowIndex].Cells[gridcboOnLevel.Name] as DataGridViewComboBoxCell; ComboBoxHelper.BindDataGridViewComboBoxCell(gridcboOnLevelCell, m_dsGridSource.Tables["gridcboOnLevel"], "Name", "Value"); DataGridViewComboBoxCell gridcboCategoryCell = this.grdData.Rows[e.RowIndex].Cells[gridcboCategory.Name] as DataGridViewComboBoxCell; ComboBoxHelper.BindDataGridViewComboBoxCell(gridcboCategoryCell, m_dsGridSource.Tables["gridcboCategory"], "Name", "Value"); }