This is one strange bug. I have a simple RadGrid with a couple of columns, I use a GridTemplateColumn with a checkbox control for deletion, heres the markup.
<
telerik:GridTemplateColumn
ItemStyle-HorizontalAlign
=
"Center"
UniqueName
=
"chkItem"
ItemStyle-Width
=
"1%"
>
<
HeaderTemplate
>
<
asp:CheckBox
runat
=
"server"
onclick
=
"$('.chk-locations2 input').prop('checked', this.checked).trigger('change');"
ID
=
"chkSelectAll"
/>
</
HeaderTemplate
>
<
ItemTemplate
>
<
asp:CheckBox
CssClass
=
"chk chk-locations2"
data-value='<%#Eval("LocationID")%>' text='<%#Eval("LocationID")%>'
runat="server" ID="chkItem" Checked="false" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Anyway, I have a button that does a full postback that checks for .Checked checkboxes and executes the delete operation, like this.
For
Each
Item
As
Telerik.Web.UI.GridItem
In
Input.Items
If
Item.ItemType = GridItemType.Item
Or
Item.ItemType = GridItemType.AlternatingItem
Then
Dim
Chk
As
CheckBox =
CType
(Item.FindControl(
"chkItem"
), CheckBox)
If
Chk.Checked
Then
Dim
ID
As
String
= Chk.Text
If
IsNumeric(ID)
Then
CallBack.Invoke(ID, Argument)
End
If
End
If
End
If
Next
All works as expected, only the checked rows are deleted and since I reload the grid again, no items are checked once the page has reloaded, it all looks ok until you refresh the page again. If your grid had say 10 items and you ticked the first item and deleted it, as expected the grid now would have 9 items. If you refresh the page, a full postback is done as expected however, the first item is marked as "Checked" when it was not, so the item is then deleted and how you have 8 items despite the fact that you had not explicitly checked any item.
This seems to be a bug in the radgrid, the checkbox is shown as Checked when nobody checked it. The only solution I can see for now is to prevent a postback with Javascript by check for the no. of checked checkboxes.