I have a GridView into which I load a few rows of data. Behind each row I have more information, which is displayed in a different form when the user clicks on the row. I also have "Previous" and "Next" buttons to navigate in the GridView.
At startup it looks like the first row is selected, it is blue and has a little arrow to the right. But when I click the "Next" button I get radgrid.SelectedRows.Count = 0, and therefore I can't navigate to the next row. If I then click on the first row I get the same result, BUT if I click on one of the other rows I get radgrid.SelectedRows.Count = 1 and everything works fine. I then can click on the first row too, getting the expected result.
Is this a bug, or is it something I'm doing wrong? Is there a way to set which row that is selected, - radgrid.Rows.SelectedIndex = 0 ?
Any help is appreciated.
Regards,
Jill-Connie Lorentsen
| protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| DataTable dt = dm.GetDtFromSQL(string.Format(SQLTemplate, ViewState["showID"]), "", ViewState["showID"].ToString(), false); |
| if (dt.Rows.Count > 0) |
| { |
| DataView dv = dt.DefaultView; |
| dv.RowFilter = ViewState["filter"].ToString(); |
| dv.Sort = string.Format("{0} {1}", ViewState["sort"], ViewState["order"]); |
| RadGrid1.DataSource = dv; |
| } |
| else |
| { |
| RadGrid1.DataSource = null; |
| } |
| } |