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

[Solved] Run server code for selected items in a grid

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 16 Oct 2009, 09:11 AM
I have a rad grid that is using the build in selection box feature (client side). I have a button above the grid. When selecting the button, I would like to be able to run a bit of server side code for each selected item within the grid.

The code requires the IdColumn, which is a column that is not visible, but is returned to the grid.

that is the code should for each selected item, use the Id to execute a stored procedure.

Any help would be much appreciated.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Oct 2009, 09:29 AM
Hi Danny,

Try the following code snippet in order to get the column values of selected rows.

CS:
  
protected void Button1_Click(object sender, EventArgs e)  
{  
    foreach( GridDataItem item in RadGrid1.SelectedItems )  
    {  
        String str = item["IdColumn"].Text;  
        Response.Write(str); // Execute the stored procedure with the selected value 
    }  
}  

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