1
How to load a Gridview into the webform with a few lines already selected ?
I’m trying the following code but without success...
protected void BindGridAcesso(int idSenha)
{
Usuario usuario = IdentificadorUsuario.ObterDadosUsuario();
var lstUsuarios = new EntidadeNegocio().ListarExcetoUsuarioLogado(usuario.UsuarioId);
if (idSenha != 0)
{
var lstUsuarioSenha = new EntidadeNegocio().ListarPorSenha(idSenha);
gdvAcesso.DataSource = lstUsuarios;
gdvAcesso.DataBind();
int linhasGrid = gdvAcesso.Rows.Count;
foreach (var item in lstUsuarioSenha)
{
foreach (GridViewRow gvr in gdvAcesso.Rows)
{
if (gvr.Cells[1].Text == item.NomeUsuario)
{
gvr.RowState = DataControlRowState.Selected;
}
}
}
}
}
I didn’t understand that your selected line would be colored or something?
– Marconi
edited the post with the image...would be with the checkbox of the selected line
– Daniel