Hi! I have a gridview, with a button which when is pressed, the row is coloured. Only one row can be selected.
But when I change page, I lose the reference of the row and it´s uncoloured. Here´s an example of my code:
PageSize="3" CssClass="table table-bordered">
protected void Edit(object sender, EventArgs e)
{
foreach (GridViewRow row1 in gvListaTit.Rows)
{
row1.BackColor = System.Drawing.Color.White;
}
ImageButton btn = sender as ImageButton;
GridViewRow row = btn.NamingContainer as GridViewRow;
if (row.BackColor == System.Drawing.ColorTranslator.FromHtml("#83CFC6"))
{
row.BackColor = System.Drawing.Color.White;
hididTitulo.Value = null;
}
else
{
row.BackColor = System.Drawing.ColorTranslator.FromHtml("#83CFC6");
hididTitulo.Value = row.Cells[0].Text;
}
How can I keep the selected row coloured when I change page? Thanks!
Sachin SinghPosted Jun 25, 2021, 9:59 AM
gabriela lopezPosted Jun 26, 2021, 1:14 AM