Hello,
I have a RadGrid with a check box column to select the row and I have used the code in this demo http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectrowwithcheckbox/defaultcs.aspx
For some reason after selecting 4th row the RadGrid.SelectedItems resets to 0.I am populating a listbox based on the selected items in the radgrid but this does not work because of the above mentioned issue. I have noticed while debugging that the non public member "Capacity" is by default set to 4, not sure how to set/override it.
For now I had to get around the problem by iterating to all the items in the Radgrid ,then use the FindControl to get the checkbox checked status and then populate the Listbox.This works so far but I feel its a workaround.
Not sure what I am missing.Any help is much appreciated.
Old code
I have a RadGrid with a check box column to select the row and I have used the code in this demo http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectrowwithcheckbox/defaultcs.aspx
For some reason after selecting 4th row the RadGrid.SelectedItems resets to 0.I am populating a listbox based on the selected items in the radgrid but this does not work because of the above mentioned issue. I have noticed while debugging that the non public member "Capacity" is by default set to 4, not sure how to set/override it.
For now I had to get around the problem by iterating to all the items in the Radgrid ,then use the FindControl to get the checkbox checked status and then populate the Listbox.This works so far but I feel its a workaround.
Not sure what I am missing.Any help is much appreciated.
Old code
((sender
as
CheckBox).NamingContainer
as
GridItem).Selected = (sender
as
CheckBox).Checked;
foreach
(GridDataItem row
in
RadGrid1.SelectedItems)
RadlstOLDest.Items.Add(
new
RadListBoxItem(row[
"OrderLineId"
].Text, row[
"OrderLineId"
].Text));
New Code
foreach
(GridDataItem row
in
RadGrid1.MasterTableView.Items)
{
if
((row.FindControl(
"CheckBox1"
)
as
CheckBox).Checked)
{
RadlstOLDest.Items.Add(
new
RadListBoxItem(row[
"OrderLineId"
].Text, row[
"OrderLineId"
].Text));
row.Selected =
true
;
}
}
Thanks,
Vikas