This is a migrated thread and some comments may be shown as answers.

Select row after PageIndexChanged

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mahdi
Top achievements
Rank 1
Mahdi asked on 17 Dec 2013, 10:18 AM
Hello
I have a problem. I can select one specific row in first page,so the color of this row will become orange for example.
when I change the page index , I can select row but the color of row will NOT become orange ,I don't know what should I do.
my grid is in Update panel.
can anybody help me?
below is my code :

 

 

 

protected void grdAuthorization_PageIndexChanged(object sender, Telerik.Web.UI.GridPageChangedEventArgs e)
       {
           List<Entity.TimeSheetAuthorizationView1> list = (List<Entity.TimeSheetAuthorizationView1>)Session[ConstantStrings.AuthorizationList];
           if (grdAuthorization.DataSource == null)
           {
               grdAuthorization.DataSource = list;
               grdAuthorization.DataBind();
           }
           grdAuthorization.CurrentPageIndex = e.NewPageIndex;
           grdAuthorization.DataBind();
           ViewState[ConstantStrings.SelectedAuthorizationId] = null;
           grdAuthorization.SelectedIndexes.Clear();
           if (list != null && list.Count > default(int))
           {
               grdAuthorization.SelectedIndexes.Add(default(int));
               int id = (int)grdAuthorization.SelectedItems[0].OwnerTableView.DataKeyValues[grdAuthorization.SelectedItems[0].ItemIndex]["Id"];
               ViewState[ConstantStrings.SelectedAuthorizationId] = id;
           }
       }

 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Dec 2013, 12:43 PM
Hi Mahdi,

I guess you are using SimpleDataBinding. Simple data-binding can be used in simple cases when you do not require the grid to perform complex operations such as Inserting, deleting, and updating, Filtering, Sorting, Paging etc. For advanced features such as those listed above, RadGrid must be bound using declarative data sources or through the NeedDataSource event. Please set the following CSS class to set the selected row style.

CSS:
<style type="text/css">
 .RadGrid_SkinName .rgSelectedRow td
 {
    background-color: Blue !important;
    border-bottom-color: Blue !important;
 }
</style>

Thanks,
Shinu

Tags
Grid
Asked by
Mahdi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or