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

client side selected items returning error

2 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sravanthi
Top achievements
Rank 1
sravanthi asked on 12 Nov 2014, 03:00 PM
Hi ,

In my rad grid we are using custom paging and client side select column.
so when the page size is 25 the selected items is not giving any error .But if i change the page size to 50 and do an update for the selected items it is throwing an error .

And when i change the page size i am have a runtime error.


please see the following code and let me know what is the problem

  <telerik:RadGrid ID="gvWorkAssignments" runat="server" CssClass="common-display-grid" AllowMultiRowSelection="True" AutoGenerateColumns="False"
                                         GridLines="None" AllowPaging="True" AllowSorting="True" PageSize="2500" Skin="Transparent"
                                         onitemdatabound="gvWorkAssignments_ItemDataBound" 
                                         onprerender="gvWorkAssignments_PreRender" 
                                         onsortcommand="gvWorkAssignments_SortCommand" 
                                         OnItemCreated="gvWorkAssignments_ItemCreated" 
                                         OnPageIndexChanged="gvWorkAssignments_OnPageIndexChanged" 
                                        
                                         OnNeedDataSource="gvWorkAssignments_NeedDataSource"
                                         OnExcelExportCellFormatting="gvWorkAssignments_ExcelExportCellFormatting" 
                                         OnHTMLExporting="gvWorkAssignments_HTMLExporting" AllowCustomPaging="True" >
                       
                            <MasterTableView DataKeyNames="CustomerId">
                                <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" PageSizeLabelText="Page Size: " PageSizes="25,50,150,250,2500" />
                                <RowIndicatorColumn HeaderStyle-Width="20px" />                              
                                <ExpandCollapseColumn HeaderStyle-Width="20px" />                              
                                <Columns>
                                    <telerik:GridClientSelectColumn UniqueName="CheckboxSelectColumn" FooterText="CheckBoxSelect footer"  >
                                        <ItemStyle Width="2%" HorizontalAlign="Center" />
                                        <HeaderStyle Width="2%" HorizontalAlign="Center"/>
                                    </telerik:GridClientSelectColumn>
                                
                                    <telerik:GridBoundColumn DataField="CustomerId" DataType="System.Int32" HeaderText="Apex Id" 
                                                             ReadOnly="True" SortExpression="CustomerId" UniqueName="CustomerId" Visible="False" AllowFiltering="False" />                                    
                                                              
                                    <telerik:GridTemplateColumn HeaderText="District/Route" Visible="True"
                                        SortExpression="RouteSortOrder" ReadOnly="True" UniqueName="RouteOrder" AllowFiltering="false">
                                        <ItemTemplate><%# Eval("District").ToString() + "-" + Eval("RouteNumber").ToString()%></ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    
                                        <telerik:GridTemplateColumn HeaderText="Route Sequence" Visible="True"
                                        SortExpression="RouteSequence" ReadOnly="True" UniqueName="RouteOrder" AllowFiltering="false">
                                        <ItemTemplate><%# Eval("RouteSequence").ToString()%></ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    
                                    <telerik:GridBoundColumn DataField="RouteSortOrder" HeaderText="Route Sort Order"  
                                                             Visible="False" ReadOnly="True" SortExpression="RouteSortOrder" UniqueName="RouteSortOrder1" AllowFiltering="false" />
                                    
                                    <telerik:GridTemplateColumn DataField="SiteStatus" HeaderText="Status" 
                                        SortExpression="SiteStatus" ReadOnly="True" UniqueName="SiteStatus" AllowFiltering="false">
                                        <ItemTemplate>
                                            <div style="float: left;white-space:nowrap;">
                                                <img alt='Status' src='<%# DisplayStatusIcon( (string)Eval("SiteStatus")) %>' /></img> &nbsp;                                            
                                                <asp:Label ID="lblStatus" runat="server" Text='<%# DisplayStatusText((string)Eval("SiteStatus")) %>' />
                                            </div>
                                        </ItemTemplate>                                       
                                    </telerik:GridTemplateColumn>
                                    
                                    <telerik:GridTemplateColumn DataField="SiteStatus" HeaderText="Status" Visible="false"
                                        SortExpression="SiteStatus" ReadOnly="True" UniqueName="SiteStatusTextOnly" AllowFiltering="false">
                                        <ItemTemplate>
                                            <div style="float: left;white-space:nowrap;">                                                                                    
                                                <asp:Label ID="lblStatusText" runat="server" Text='<%# DisplayStatusText((string)Eval("SiteStatus")) %>' />
                                            </div>
                                        </ItemTemplate>                                       
                                    </telerik:GridTemplateColumn>
                         
                                    <telerik:GridBoundColumn DataField="CustomerName" HeaderText="Customer" 
                                                             ReadOnly="True" SortExpression="CustomerName" UniqueName="CustomerName" AllowFiltering="False" />                                    
                                    
                                    <telerik:GridTemplateColumn DataField="Address" HeaderText="Address" SortExpression="Address" 
                                                                ReadOnly="True" UniqueName="AddressHyperLink">
                                        <ItemTemplate>
                                            <a href='JobSiteDetails.aspx?id=<%# Eval("CustomerId") %>' onclick="return popupwincustom(this,.25,.25, '')"><%# Eval("Address") + (Eval("Address2") != null ? " " + Eval("Address2") : "")%></a>&nbsp;                                           
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>  
                                      <telerik:GridTemplateColumn DataField="MeterLocationFlag" HeaderText="Meter Location" SortExpression="MeterLocation" 
                                                                ReadOnly="True" UniqueName="MeterLocation" Visible="false" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <%# ShowMeterLocation((ProField.Meter.CustomerWA)Container.DataItem)%>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    
                                    <telerik:GridBoundColumn DataField="PremiseNumber" HeaderText="Premise" ReadOnly="True" SortExpression="PremiseNumber" UniqueName="PremiseNumber" AllowFiltering="false" Visible="false" />
                                    
                                    <telerik:GridTemplateColumn HeaderText="Meter/Form" SortExpression="FormNum" ReadOnly="True" UniqueName="FormClass"
                                                                ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" AllowFiltering="False">
                                        <ItemTemplate>
                                            <%# ShowMeterInfo((ProField.Meter.CustomerWA)Container.DataItem)%>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    
                                    <telerik:GridTemplateColumn DataField="ApptDate" HeaderText="Service Date" SortExpression="ApptDate" ReadOnly="True" UniqueName="ApptDate"
                                                                ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Left" AllowFiltering="False">
                                        <ItemTemplate>
                                            <%# DisplayApptDate((ProField.Meter.CustomerWA)Container.DataItem)%>
                                            <%--<%# DisplayCompletedShortDate((ProField.Meter.CustomerWA)Container.DataItem)%>--%>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    
                                    <telerik:GridTemplateColumn DataField="NewMeterReadDate" HeaderText="Completed Date" SortExpression="NewMeterReadDate" ReadOnly="True" UniqueName="NewMeterReadDate"
                                                                ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" AllowFiltering="False">
                                        <ItemTemplate>
                                            <%# DisplayCompletedDate((ProField.Meter.CustomerWA)Container.DataItem)%>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    
                                    <telerik:GridBoundColumn DataField="LegacyMeterSerial" HeaderText="Meter#" 
                                                             ReadOnly="True" SortExpression="LegacyMeterSerial" UniqueName="LegacyMeterSerial" AllowFiltering="False" />     
                                    
                                    <telerik:GridBoundColumn DataField="AssignedTechName" HeaderText="Installer" 
                                                             ReadOnly="True" SortExpression="AssignedTechName" UniqueName="AssignedTechName" AllowFiltering="False" /> 
                                                             
                                    <telerik:GridBoundColumn DataField="Latitude" DataType="System.Double" HeaderText="GPS Latitude" UniqueName="Latitude" Visible="false" /> 
                                    
                                    <telerik:GridBoundColumn DataField="Longitude" DataType="System.Double" HeaderText="GPS Longitude" UniqueName="Longitude" Visible="false" />
                                    
                                    <telerik:GridTemplateColumn UniqueName="NotesTemplate" SortExpression="Notes" HeaderText="Notes" AllowFiltering="false" 
                                                                ReadOnly="false" Visible="true" ItemStyle-Width="2%" HeaderStyle-Width="2%" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <div style="width:40px">
                                                <div class="split">
                                                    <asp:HyperLink ID="notesTargetControl" runat="server" NavigateUrl="#">
                                                        <asp:Image runat="server" ImageUrl="~/Images/Icons/Notes-icon.png" AlternateText="Notes" BorderWidth="0px" />
                                                    </asp:HyperLink>
                                                </div>
                                                <div class="split">
                                                    <asp:HyperLink ID="peTargetControl" runat="server" NavigateUrl="#">
                                                        <asp:Image runat="server" ImageUrl="<%# ShowProblemCountsIcon((ProField.Meter.CustomerWA)Container.DataItem) %>" AlternateText="Problem Counts" BorderWidth="0px" />
                                                    </asp:HyperLink>
                                               </div>
                                                <div class="split">
                                                    <img src='<%# ShowMailedIcon((ProField.Meter.CustomerWA)Container.DataItem) %>' alt='Mailed' style="border-width:0px;" />                                            
                                               </div>
                                           </div>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    
                                     <telerik:GridTemplateColumn DataField="IsDelivered" HeaderText="Delivered" SortExpression="IsDelivered" ReadOnly="True" UniqueName="IsDelivered"
                                                                ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" AllowFiltering="False">
                                        <ItemTemplate>                                           
                                            <%# ((ProField.Meter.CustomerWA)Container.DataItem).IsDelivered ? "Yes" : "No"%>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Log Call" UniqueName="CallLog">
                                        <ItemTemplate>
                                            <asp:HyperLink ID="hlLogCall" runat="server" ImageUrl="~/Images/Icons/call-log-icon.png" ToolTip="Log Customer Call Attempt" />
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" Width="5%" />
                                        <HeaderStyle HorizontalAlign="Center" Width="5%" />
                                    </telerik:GridTemplateColumn>
                               
                                </Columns>
                            </MasterTableView>
                            
                            <ClientSettings EnableRowHoverStyle="true">
                                <ClientEvents OnRowSelecting="RowSelecting" OnRowDeselecting="RowDeselecting" />
                                <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true" />                                 
                            </ClientSettings>
                            <PagerStyle AlwaysVisible="true" Position="TopAndBottom" />
                        </telerik:RadGrid>            


  function RowSelecting(sender, args) {

                var id = args.get_id();
                var inputCheckBox = $get(id).getElementsByTagName("input")[0];
                if (!inputCheckBox || inputCheckBox.disabled) {
                    //cancel selection for disabled rows
                    args.set_cancel(true);
                }
                    // if no more unselected enabled rows left - check the header checkbox
                else if (parseInt($get('<%= HiddenField2.ClientID %>').value, 10) + grid.get_masterTableView().get_selectedItems().length + 1 == grid.get_masterTableView().get_dataItems().length) {
                    checkBox.checked = true;
                }
            }


private void DoAssignUpdate()
        {

            List<int> idList = new List<int>();
           
            if (gvWorkAssignments.SelectedItems != null)----------------------->this when the error happens

            {

            }
       }


This is the page size change runtime error
Uncaught SyntaxError: Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '

        .submit::-moz-focus-inner
        {
               border: 0;  /* Small centering fix for Firefox */
        }'. 
and 
this is the error where selected items of the grid referred 


specified argument was out of the range of valid values. parameter name: itemhierarchicalindex



     
                      


2 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 17 Nov 2014, 11:46 AM
Hello Sravanthi,

Could you please try to remove all comments in your CSS and see if the first error will be removed. Additionally you can try to temporarily disable any AJAX that you have on the page.

If you continue to experience the same problems, please try to isolate the problem in a sample, runnable project and open a regular support ticket, so we can further investigate the issue.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Vijay
Top achievements
Rank 1
answered on 20 Nov 2014, 06:51 PM
thanks kevin,

i figured the issue is the way i am rebinding the grid


Thank you for replying back


Thanks,Sravanthi


Tags
Grid
Asked by
sravanthi
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Vijay
Top achievements
Rank 1
Share this question
or