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

get the selected items

2 Answers 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 07 Jun 2011, 09:38 PM
Hi everyone,

I'm currently using a grid that allow the multi-selection. What I want is once the user clicks on ADD, all the selected data are add in a database. My problem is I can't find the value of the selecteds values. If "AllowMultiRowSelection" is set to false, it's simple, I just have to use the propriety selectedValue. But if many row are selected, this propriety will only return one selectedValue. I tried the propriety selectedValues, but it does the same. I read in the documentation that I can use a GridDataItem to access a row, but I don't know if it is the best solution. May someone help me ?

Thank you   

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Jun 2011, 08:37 AM
Hello David,

Try the following approach to get the selected items in a Button click. Hope this helps you.

C#:
protected void Button2_Click(object sender, EventArgs e)
   {
       foreach (GridDataItem item in RadGrid1.SelectedItems)
       {
           string selectedValue = (RadGrid1.SelectedItems[0] as GridDataItem)["ColumnUniqueName"].Text;        
       }      
   }

Thanks,
Princy.
0
David
Top achievements
Rank 1
answered on 08 Jun 2011, 02:10 PM
Yep, it helps me a lot
Thanks
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
David
Top achievements
Rank 1
Share this question
or