I have a radgrid that ispopulated using the need_datasource event. We have a delete button in the grid and when you click the delete, it fires an itemcommand to delete the record and then rebinds the grid. The record successfully gets deleted, but the grid does not reflect this change. The stranger part is that when I step through the code using the debugger, the grid DOES refresh correctly.
We've been using telerik grids for a long time now, and never had this problem. We recently updated to Q1 2010, and I'm wondering if there's some sort of caching going on that we need to explicitly turn off now?
Here's the grid:
And here's the code-behind:
We've been using telerik grids for a long time now, and never had this problem. We recently updated to Q1 2010, and I'm wondering if there's some sort of caching going on that we need to explicitly turn off now?
Here's the grid:
<telerik:RadGrid ID="MyGrid" runat="server" AllowPaging="false" AutoGenerateColumns="false" GridLines="None" ShowHeader="True" OnNeedDataSource="MyGrid_NeedDataSource" OnItemCommand="MyGrid_ItemCommand" OnItemDataBound="MyGrid_ItemDataBound"> <MasterTableView AutoGenerateColumns="false" Width="100%" TableLayout="Fixed"> <Columns> <telerik:GridBoundColumn UniqueName="Id" DataField="PlanId" HeaderText="Id" Visible="false" /> <telerik:GridBoundColumn UniqueName="Name" DataField="Name" HeaderText="Name" /> <telerik:GridTemplateColumn> <ItemTemplate> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td style="border: none; width: 18px; padding: 0;"> <asp:ImageButton ID="DeleteImageButton" runat="server" ToolTip="Delete" ImageUrl="App_Themes/PlanAdvisor/Grid/Delete.png" CommandName="DeleteItem"/> </td> </tr> </table> </ItemTemplate> <HeaderStyle HorizontalAlign="Right" Width="55px"></HeaderStyle> <ItemStyle HorizontalAlign="Right"></ItemStyle> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid>And here's the code-behind:
Protected Sub MyGrid_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs) Handles MyGrid.ItemCommand If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then Dim item As GridDataItem = CType(e.Item, GridDataItem) If e.CommandName = "DeleteItem" Then DeleteItem(CInt(item("Id").Text)) MyGrid.Rebind() End If End If End Sub