views:

347

answers:

1

On pageIndexChanged, I set the first row in the grid to be selected, as follows:

//I'd love to get rid of this, but the SelectedDataKey is empty otherwise
Grid.DataBind();   

Grid.SelectedIndex = 0;

Grid.Rows[0].RowState = DataControlRowState.Selected;

The row is selected, but the SelectedRowStyle is not applied. Even if I reset it, like so

Grid.SelectedRowStyle.CssClass = "selected";

Any ideas why the style isn't applied? Thanks!

+1  A: 

try to set this in the grid DataBound event

Grid.SelectedRowStyle.CssClass = "selected";

Muhammad Akhtar
I did, like I said.
Bob_Kruger