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

Unselect row when click on add new in radgrid

1 Answer 161 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Laura
Top achievements
Rank 1
Laura asked on 07 Jan 2009, 08:16 PM
I have 2 radgrids with the first one being a parent grid(packages), and when a user clicks on a row, a related grid(package contents) for that row gets populated. I am using the control parameter in the datasource of the second grid as the selectedvalue of the selected row in the first grid.

The user also has the option to add a new package. I want to programmatically (in javascript or C#) de-select the row on the click on add new and then automatically select the new inserted item so that the second grid can rebind using the new package.

Is this possible?

Thanks,
Laura

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 08 Jan 2009, 07:23 AM
Hello Laura,

You can set the AllowultiRowSelection property of the grid to false so that only one row is selected at a time. You can also try out the following code to deselect the rows on clicking the AddNewRecord Button:
cs:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
       if (e.CommandName == RadGrid.InitInsertCommandName) 
        { 
            foreach (GridDataItem dataItem in RadGrid1.SelectedItems) 
            { 
                dataItem.Selected = false;                
            } 
        } 
 
    } 

Refer to the following code library submission  which explains on how to get the last inserted row selected.
Select Last Inserted Row

Princy.
Tags
Grid
Asked by
Laura
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or