I have a radgrid and I would like to provide checkboxes in first column for each record. If I use
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" />
how can I get the checkbox selection on server side so that I know which record to update. the user can do multiple selections. pls provide me an example.
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" />
how can I get the checkbox selection on server side so that I know which record to update. the user can do multiple selections. pls provide me an example.
7 Answers, 1 is accepted
0
Schlurk
Top achievements
Rank 2
answered on 05 Nov 2009, 11:02 PM
I believe this article, which explains how to keep selected rows through postback, should provide you with an example of how to interact with selected items. Using the same basic logic here you should be able to do whatever it is you want to do. There are also a few other articles in the documentation that might help you with your implementation, I recommend you check them out :D
0
Shinu
Top achievements
Rank 2
answered on 06 Nov 2009, 06:11 AM
Hi,
You can traverse the selected items collection in a button click as shown below:
C#
Thanks,
Shinu
You can traverse the selected items collection in a button click as shown below:
C#
| protected void Button1_Click(object sender, EventArgs e) |
| { |
| foreach(GridDataItem item in RadGrid1.SelectedItems) |
| { |
| Response.Write(item["CustomerID"].Text.ToString() + "<br/>"); |
| string custID = item.GetDataKeyValue("CustomerID").ToString(); |
| } |
| } |
Thanks,
Shinu
0
cognos s
Top achievements
Rank 1
answered on 08 Nov 2009, 05:09 PM
grd.selecteditems.count is 0 on the server side. I can approach this in a different manner.
0
Dimo
Top achievements
Rank 1
answered on 08 Mar 2010, 04:12 PM
Yes, I found this also -SelectedItems in nothing , but row is checked. Please give me working code for this -its urgent:)
0
Princy
Top achievements
Rank 2
answered on 09 Mar 2010, 08:03 AM
Hi,
How are you binding your grid ?.Could you post your code here. At times the selected item count will not return anything if the grid is not properly bound or you are making excess calls to Rebind.
Thanks,
Princy
0
Dimo
Top achievements
Rank 1
answered on 09 Mar 2010, 08:35 AM
| grdList.DataSource = objBO.ExecQueryText("SELECT * FROM [Pages]").Tables(0) |
| grdList.Rebind() - in Page_Load and now I consider to use client-side js + hidden field, but prefer direct server side selecteditems use |
0
Hello Dimo,
When you invoke the Rebind() method of the grid explicitly, the selected items (and their indices respectively) will be cleared. Hence consider modifying your grid binding to utilize NeedDataSource event handling as illustrated on this online demo of the product:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/needdatasource/defaultvb.aspx
Thus the grid will be rebound internally on sorting, paging, etc. operation and the selected items state will be retained.
Kind regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
When you invoke the Rebind() method of the grid explicitly, the selected items (and their indices respectively) will be cleared. Hence consider modifying your grid binding to utilize NeedDataSource event handling as illustrated on this online demo of the product:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/needdatasource/defaultvb.aspx
Thus the grid will be rebound internally on sorting, paging, etc. operation and the selected items state will be retained.
Kind regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.