//取出GridView数据源中的绑定对象集合 private ETLSapTableResultCollection getDataByGridView(GridView grid, int sortNo) { ETLSapTableResultCollection result = new ETLSapTableResultCollection(); for (int i = 0; i < grid.Rows.Count; i++) { ETLSapTableResult item = new ETLSapTableResult(); item.EntityName = grid.ToolTip; item.IsEnable = ((CheckBox)grid.Rows[i].FindControl("cb_IsEnable")).Checked; item.IsPrimaryKey = ((CheckBox)grid.Rows[i].FindControl("cb_IsPrimaryKey")).Checked; item.FieldName = ((Label)grid.Rows[i].FindControl("lbl_FieldName")).Text; item.FieldDesc = ((Label)grid.Rows[i].FindControl("lbl_FieldDesc")).Text; FieldTypeEnum fieldType; FieldTypeEnum.TryParse(((Label)grid.Rows[i].FindControl("lbl_FieldType")).Text, out fieldType); item.FieldType = fieldType; item.FieldLength = Convert.ToInt32(((Label)grid.Rows[i].FindControl("lbl_FieldLength")).Text); item.IsIndex = ((CheckBox)grid.Rows[i].FindControl("cb_IsIndex")).Checked; if (checkIsCommon.Checked) { item.IsKey = ((CheckBox)grid.Rows[i].FindControl("cb_IsKey")).Checked; item.IsValue = ((CheckBox)grid.Rows[i].FindControl("cb_IsValue")).Checked; } item.RefTableName = ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefTableName")).SelectedIndex == 0 ? string.Empty : ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefTableName")).SelectedValue; item.RefFieldName = ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefFieldName")).SelectedValue.Trim() == "" ? string.Empty : ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefFieldName")).SelectedValue; item.SortNo = sortNo; result.Add(item); } return(result); }