private void ConnectionEdit_Load(object sender, EventArgs e) { this.colConnectionType.DataSource = Enum.GetNames(typeof(WSH.CodeBuilder.DispatchServers.DataBaseType)); if (IsSelect) { this.grid.AllowUserToAddRows = false; this.grid.AllowUserToDeleteRows = false; this.grid.AllowMenuDelete = false; this.grid.ReadOnly = true; } DataSource = service.GetConnectionDataTable(); this.grid.DataSource = DataSource; if (!string.IsNullOrEmpty(this.RecordID)) { foreach (DataGridViewRow row in this.grid.Rows) { if (!row.IsNewRow) { DataRowView rowView = (DataRowView)(row.DataBoundItem); if (ConvertHelper.AsEmpty(rowView["ID"]) == this.RecordID) { row.Selected = true; break; } } } } }