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

Insertion

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sindhu1
Top achievements
Rank 1
sindhu1 asked on 15 Oct 2010, 11:47 PM
I have a radgrid displayed with columns from a table and with a checkbox column on left which allows selection.....i have enabled multiple row selections...I have a button on the page by clicking it i should be able to insert all the selected records into other table....can you tell me how to do multiple  row insertions on button click event....

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Oct 2010, 07:40 AM
Hello Sindhu,


One suggestion is iterating through the SelectedItems in grid and updating the db after accessing the cell values.

A sample code is shown below.
protected void Button1_Click(object sender, EventArgs e)
{
    string empId;
    foreach( GridDataItem selectedItem in RadGrid1.SelectedItems )
    {
        empId = selectedItem["EmployeeId"].Text;
        // Your code to update db
    }
}



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