Could you tell me if there is any simple property or way of putting an identifier in the rows of the grid but without being the ID in the table, for example I have 5 records with id 32,45,99,100ee 200. But I want to put on the grid 1,2,3,4 and 5. Type an auto increment, any suggestions?
Code used for the Grid:
var lista = from substituidos in vagaDTO.Substituidos
where substituidos.Operacao != SysDTO.Operacoes.Exclusao
select new
{
substituidos.IdClasse,
substituidos.Id,
Matrícula = substituidos.Matricula_Substituido ,
Substituído = substituidos.Substituido,
Contratante = substituidos.Numero_CTT,
Local = (substituidos.Endereco == null ? "" : substituidos.Endereco.Sigla),
Dt_Enc = string.Format("{0:dd/MM/yy}", substituidos.Data_Enc),
Dt_Saída = string.Format("{0:dd/MM/yy}", substituidos.Data_Saida),
Prev_Deslig = string.Format("{0:dd/MM/yy}", substituidos.Prev_Desligamento),
Prev_Fer_Ini = string.Format("{0:dd/MM/yy}", substituidos.Prev_Ferias_Inicio),
Prev_Fer_Fim = string.Format("{0:dd/MM/yy}", substituidos.Prev_Ferias_Final),
Fer_Ini = string.Format("{0:dd/MM/yy}", substituidos.Ferias_Inicio),
Fer_Fim = string.Format("{0:dd/MM/yy}", substituidos.Ferias_Final)
};
//dtgSubstituidos.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
lista = lista.OrderBy(p => p.Substituído).ToList();
dtgSubstituidos.DataSource = lista.ToList();
dtgSubstituidos.Columns[0].Visible = false;
dtgSubstituidos.Columns[1].Visible = false;
dtgSubstituidos.Columns[4].Visible = false;
dtgSubstituidos.Columns[2].Width = 50;
dtgSubstituidos.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
dtgSubstituidos.Columns[3].Width = 150;
dtgSubstituidos.Columns[5].Width = 200;
dtgSubstituidos.Columns[6].Width = 60;
dtgSubstituidos.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dtgSubstituidos.Columns[7].Width = 60;
dtgSubstituidos.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dtgSubstituidos.Columns[8].Width = 60;
dtgSubstituidos.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dtgSubstituidos.Columns[9].Width = 60;
dtgSubstituidos.Columns[9].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dtgSubstituidos.Columns[10].Width = 60;
dtgSubstituidos.Columns[10].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dtgSubstituidos.Columns[11].Width = 60;
dtgSubstituidos.Columns[11].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dtgSubstituidos.Columns[12].Width = 60;
dtgSubstituidos.Columns[12].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;