This is a migrated thread and some comments may be shown as answers.

Error is coming with Sorting and Deleting record , if there is single record.

1 Answer 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saurabh
Top achievements
Rank 1
Saurabh asked on 04 Oct 2012, 01:58 PM
Hi , i am using Q1 2011 version of rad control in the application

 

 

<telerik:RadGrid EnableEmbeddedSkins="false" CssClass="RadGrid_Outlook grid-inside-section"

 

 

 

ID="rdGridReport" runat="server" AutoGenerateColumns="False" PageSize="10"

 

 

 

AllowSorting="true" AllowPaging="true" Skin="Outlook">

 

 

 

<ClientSettings EnableRowHoverStyle="true">

 

 

 

<Selecting AllowRowSelect="true" />

 

 

 

</ClientSettings>

 

 

 

<MasterTableView DataKeyNames="ReportId" ClientDataKeyNames="ReportId" HeaderStyle-VerticalAlign="Top"

 

 

 

HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left">

 

 

 

<DetailTables>

 

 

 

<telerik:GridTableView DataKeyNames="ID" runat="server" Name="sample" Width="100%" PageSize="10">

 

 

 

<ParentTableRelation>

 

 

 

<telerik:GridRelationFields DetailKeyField="ReportId" MasterKeyField="ReportId" />

 

 

 

</ParentTableRelation>

 

 

 

<ExpandCollapseColumn Visible="True">

 

 

 

</ExpandCollapseColumn>

 

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn UniqueName="chkID" DataField="ID" HeaderStyle-Width="25px"

 

 

 

AllowFiltering="false" ItemStyle-HorizontalAlign="Left">

 

 

 

<HeaderTemplate>

 

 

 

<asp:CheckBox ID="cbAllCheckBox" runat="server" AutoPostBack="true" OnCheckedChanged="CheckAllCheckBoxes"

 

 

 

onclick="MakeDirty(this);" />

 

 

 

</HeaderTemplate>

 

 

 

<ItemTemplate>

 

 

 

<asp:CheckBox ID="chkOTCID" runat="server" Width="12px" onclick="checkboxClicked(event, this.id)" />

 

 

 

</ItemTemplate>

 

 

 

<HeaderStyle Width="25px" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderStyle-Width="50px"

 

 

 

ItemStyle-HorizontalAlign="Left">

 

 

 

<HeaderStyle Width="50px" />

 

 

 

</telerik:GridEditCommandColumn>

 

 

 

<telerik:GridBoundColumn UniqueName="ID" DataField="ID" HeaderText="ID" Visible="false" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="pName" DataField="pName"

 

 

 

HeaderText="Project" HeaderStyle-Width="20%" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="File" DataField="PropertyNumber"

 

 

 

HeaderText="File" HeaderStyle-Width="20%" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="FileType" DataField="FileType"

 

 

 

HeaderText="File Type" HeaderStyle-Width="20%" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="DescriptionDate"

 

 

 

DataField="DescriptionDate" HeaderText="Description Date"

 

 

 

HeaderStyle-Width="10%" />

 

 

 

<telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" UniqueName="Status" DataField="Status"

 

 

 

HeaderText="Status" HeaderStyle-Width="15%" />

 

 

 

<telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete"

 

 

 

ConfirmDialogType="Classic" ConfirmTitle="Confirm Delete" ConfirmText="Are you sure you want to delete this record?"

 

 

 

ItemStyle-HorizontalAlign="Left">

 

 

 

<HeaderStyle Width="50px" />

 

 

 

</telerik:GridButtonColumn>

 

 

 

<telerik:GridTemplateColumn Visible="false">

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="lbStatus" runat="server" Text='<%#Bind("Status") %>'></asp:Label>

 

 

 

<asp:Label ID="lbPropertyActive" runat="server" Text='<%#Bind("Active") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

<EditFormSettings EditFormType="WebUserControl" UserControlName="~/Approvals.ascx">

 

 

 

<EditColumn UniqueName="EditCommandColumn1">

 

 

 

</EditColumn>

 

 

 

</EditFormSettings>

 

 

 

</telerik:GridTableView>

 

 

 

</DetailTables>

 

 

 

<ExpandCollapseColumn Visible="True">

 

 

 

</ExpandCollapseColumn>

 

 

 

<Columns>

 

 

 

<telerik:GridBoundColumn DataField="ReportId" HeaderText="ReportId" UniqueName="ReportId"

 

 

 

Visible="false" />

 

 

 

<telerik:GridBoundColumn DataField="ReportName" HeaderText="Report Name" UniqueName="ReportName">

 

 

 

<HeaderStyle Width="200px" />

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn>

 

 

 

<ItemTemplate>

 

 

 

<asp:LinkButton ID="lbDownLoadReport" runat="server" Text="OTC Report" CommandName="Download"></asp:LinkButton>

 

 

 

</ItemTemplate>

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn UniqueName="UnSubmit">

 

 

 

<ItemTemplate>

 

 

 

<asp:LinkButton ID="lbUnSubmitReport" runat="server" Text="UnSubmit Report" ToolTip="UnSubmit Report"

 

 

 

CommandName="UnSubmit" OnClientClick="if( ! OTCReportcheck()) return false;"></asp:LinkButton>

 

 

 

</ItemTemplate>

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

<ItemStyle VerticalAlign="Top" Wrap="True" />

 

 

 

<HeaderStyle VerticalAlign="Top" />

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

-----------------------------------------------------------

Above is html of grid , poblem i am facing

 

 

I delete the last record using the Delete button in DetailTables (last column) ,telerik inbuilt javascript breaks .
Although it works fine when record reaches at top using sorting.

Following is error log:


ception of type 'System.Web.HttpUnhandledException' was thrown.   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.layouts_singlelayout_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously).

----------------------------
 Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index   at System.Collections.ArrayList.get_Item(Int32 index)
   at Telerik.Web.UI.GridTableView.SetDataSourceFilter()
   at Telerik.Web.UI.GridTableView.FilterDetailDataSource()
   at Telerik.Web.UI.GridTableView.DataBind()
   at Telerik.Web.UI.GridTableView.Rebind()
   at Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source)
   at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
   at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

 

 

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 08 Oct 2012, 04:16 PM
Hi Saurabh,

Could you confirm that you are not using simple data-binding. When using simple data-binding the grid does not support operations like:
  • Inserting, deleting, and updating records through custom edit forms (WebUserControl or FormTemplate)
  • Grouping
  • Hierarchy relations
  • Filtering
  • Sorting
  • Paging
For advanced features such as those listed above, RadGrid must be bound using declarative data sources or through the NeedDataSource event.

Greetings,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Saurabh
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or