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

Getting row in selected state

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John John
Top achievements
Rank 1
John John asked on 16 Apr 2010, 11:27 AM

Hi

            I amhaving radgrid which has NestedGrid also. I would like to see my row is beingselected when invoking edit and close the editpopup window. So that the clientcan be known what row is selected after coming back from updating or closingthe PopUp window?

I used the below scenarios, it is working fine with singlegrid. But in nested grid suppose I expanded two parent items in order to edittheir child items. I could not able to save the state of row after theoperation has been done.

if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
                    { 
                        if (!e.Item.OwnerTableView.IsItemInserted) 
                        { 
                            Session["selIndex"] = e.Item.ItemIndex; 
                        } 
                        e.Item.Selected = true
                        isSelected = true
                    } 
 

protected void RadChild1_PreRender(object sender, EventArgs e) 
        {  
            if (!isSelected && Session["selIndex"] != null) 
            { 
                RadChild1.MasterTableView.Items[(int)Session["selIndex"]].Selected = true
                Session["selIndex"] = null; 
            } 
            isSelected = false
        } 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Apr 2010, 11:55 AM
Hello John,

One suggestion would be saving the key values for the selected row in a Session variable and in the pre-render event of the grid, traverse the rows of the grid and compare their key values to the values saved in the Session variable. Whenever you find a match, select the row.
I hope the documentation will help you in getting strated.

-Shinu.
Tags
Grid
Asked by
John John
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or