Hi support,
I am attempting to institute a radgrid using a user control insert/edit form. I am running into a problem with deletion of the last row in the grid on the last page. For example, I have a situation where there are 4 records in the grid with a pagesize of 3. If I delete the 4th record then after the successful deletion, the paging is thrown out of whack and the grid can no longer find any records within the grid. Moreover, the grid will not rebind either. As I have a dropdown that controls the grid datasource which generally allows a different search.
Note, since I have the paging as "always visible" the pager at the bottom is clickable and if I click the page number at the bottom it will reorient the grid and put everything into the right place. I have tried a number of things and don't know where to go.
Without this always visible on, it is totally broken.
Josh
I have copied and pasted the relevant code below
I am attempting to institute a radgrid using a user control insert/edit form. I am running into a problem with deletion of the last row in the grid on the last page. For example, I have a situation where there are 4 records in the grid with a pagesize of 3. If I delete the 4th record then after the successful deletion, the paging is thrown out of whack and the grid can no longer find any records within the grid. Moreover, the grid will not rebind either. As I have a dropdown that controls the grid datasource which generally allows a different search.
Note, since I have the paging as "always visible" the pager at the bottom is clickable and if I click the page number at the bottom it will reorient the grid and put everything into the right place. I have tried a number of things and don't know where to go.
Without this always visible on, it is totally broken.
Josh
I have copied and pasted the relevant code below
<asp:Panel ID="PanelRadGrid" runat="server" style="table-layout:fixed; clear:both;" > |
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" PageSize="3" |
AllowSorting="True" AllowPaging="True" AllowMultiRowSelection="False" |
OnNeedDataSource="RadGrid1_NeedDataSource" |
OnItemCommand="RadGrid1_ItemCommand" |
OnInsertCommand="RadGrid1_InsertCommand" |
OnUpdateCommand="RadGrid1_UpdateCommand" |
OnDeleteCommand="RadGrid1_DeleteCommand" |
OnItemCreated="RadGrid1_ItemCreated" |
OnItemDataBound="RadGrid1_ItemDataBound" |
Skin="Mastrr" |
> |
<PagerStyle Mode="NumericPages" HorizontalAlign="Center" AlwaysVisible="true" /> |
<MasterTableView EnableTheming="false" InsertItemPageIndexAction="ShowItemOnCurrentPage" InsertItemDisplay="Bottom" DataKeyNames="PendForReviewKey" Width="100%" GridLines="None" AllowMultiColumnSorting="True" |
CurrentResetPageIndexAction="SetPageIndexToFirst" CommandItemDisplay="Bottom" TableLayout="Auto" ShowHeadersWhenNoRecords="true"> |
<Columns> |
<telerik:GridTemplateColumn> |
<ItemTemplate> |
<asp:Button ID="ButtonEdit" runat="server" CommandName="Edit" CssClass="rgEdit" ToolTip="Edit" /> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn UniqueName="Person" SortExpression="Person" HeaderText="Person" |
DataField="Person"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="Product" SortExpression="Product" HeaderText="Product" |
DataField="Product"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="RenderOrg" SortExpression="RenderOrg" HeaderText="Rendering Organization" |
DataField="RenderOrg"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="BillingOrg" SortExpression="BillingOrg" HeaderText="Billing Organization" |
DataField="BillingOrg"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="BillingOrgTreeFlag" HeaderText="Org Tree Flag" |
DataField="BillingOrgTreeFlag"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="Diagnosis" SortExpression="Diagnosis" HeaderText="Diagnosis Code" |
DataField="Diagnosis"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="EffectiveDate" SortExpression="EffectiveDate" HeaderText="Effective Date" |
DataField="EffectiveDate"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn UniqueName="ExpirationDate" SortExpression="ExpirationDate" HeaderText="Expiration Date" |
DataField="ExpirationDate"> |
</telerik:GridBoundColumn> |
<telerik:GridTemplateColumn UniqueName="TemplateColumn"> |
<ItemTemplate> |
<asp:Button ID="ButtonDelete" runat="server" CommandName="Delete" CssClass="rgDel" ToolTip="Delete" |
OnClientClick="javascript:if(!confirm('This action will delete the selected Pend For Review Record. Continue?')){return false;}"/> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
<EditFormSettings UserControlName="../AdminUC/ManagePendForReviewUC.ascx" EditFormType="WebUserControl"> |
</EditFormSettings> |
<CommandItemSettings AddNewRecordText="" |
RefreshText="" /> |
</MasterTableView> |
<ClientSettings AllowKeyboardNavigation="True"> |
<Selecting AllowRowSelect="False" /> |
</ClientSettings> |
</telerik:RadGrid> |
/// <summary> |
/// The Delete event. Occurs when user clicks the trash can icon on the edit form. |
/// </summary> |
/// <param name="source"></param> |
/// <param name="e"></param> |
protected void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e) |
{ |
Int16 pendForReviewKey = Convert.ToInt16(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["PendForReviewKey"]); |
PendForReview.Delete(pendForReviewKey); |
// Return to grid mode out of edit mode if that's where the user was. |
e.Item.Edit = false; |
} |