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

[Solved] Javascript error for grouping

4 Answers 125 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael Tao
Top achievements
Rank 1
Michael Tao asked on 02 Sep 2009, 08:52 AM
Hi:
  I am the freshman for the Telerik. I just encounter a strange problem when using the grouping functionality provided by Grid.
  I just follow the grouping demo(Outlook-style Grouping) provided by Grid. It works fine.  But when i want to remove one of the grouping option, an error is throw. "Sys.WebForms.PageRequestManagerServerErrorException:Specified argument was out of range of valid value.Parameter Name: index"
  Please check my source code.


    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
<div>  
        <%--        <telerik:Header runat="server" ID="Header1" NavigationLanguage="CS">  
        </telerik:Header>--%>  
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings>  
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                    <UpdatedControls>  
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />  
                    </UpdatedControls>  
                </telerik:AjaxSetting>  
            </AjaxSettings>  
        </telerik:RadAjaxManager>  
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">  
        </telerik:RadAjaxLoadingPanel>  
    </div>  
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" 
        GridLines="None" AutoGenerateColumns="False" Width="400px" PageSize="4" AllowCustomPaging="True" 
        ShowGroupPanel="true" PagerStyle-Position="Bottom" OnPageIndexChanged="RadGrid1_PageIndexChanged" 
        OnSortCommand="RadGrid1_SortCommand"  PagerStyle-AlwaysVisible="true" 
        OnGroupsChanging="RadGrid1_GroupsChanging"   
        onpagesizechanged="RadGrid1_PageSizeChanged">  
        <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>  
        <MasterTableView>  
            <GroupByExpressions>  
                <telerik:GridGroupByExpression>  
                    <SelectFields>  
                        <telerik:GridGroupByField FieldAlias="Sex" FieldName="Sex"></telerik:GridGroupByField>  
                    </SelectFields>  
                    <GroupByFields>  
                        <telerik:GridGroupByField FieldName="Sex" SortOrder="Descending"></telerik:GridGroupByField>  
                    </GroupByFields>  
                </telerik:GridGroupByExpression>  
                <telerik:GridGroupByExpression>  
                    <SelectFields>  
                        <telerik:GridGroupByField FieldAlias="Age" FieldName="Age"></telerik:GridGroupByField>  
                    </SelectFields>  
                    <GroupByFields>  
                        <telerik:GridGroupByField FieldName="Age" SortOrder="Descending"></telerik:GridGroupByField>  
                    </GroupByFields>  
                </telerik:GridGroupByExpression>  
                <telerik:GridGroupByExpression>  
                    <SelectFields>  
                        <telerik:GridGroupByField FieldAlias="Name" FieldName="Name"></telerik:GridGroupByField>  
                    </SelectFields>  
                    <GroupByFields>  
                        <telerik:GridGroupByField FieldName="Name" SortOrder="Descending"></telerik:GridGroupByField>  
                    </GroupByFields>  
                </telerik:GridGroupByExpression>  
            </GroupByExpressions>  
            <RowIndicatorColumn>  
                <HeaderStyle Width="20px"></HeaderStyle>  
            </RowIndicatorColumn>  
            <ExpandCollapseColumn>  
                <HeaderStyle Width="20px"></HeaderStyle>  
            </ExpandCollapseColumn>  
            <Columns>  
                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="column" SortExpression="Name">  
                </telerik:GridBoundColumn>  
                <telerik:GridBoundColumn DataField="Sex" HeaderText="Sex" UniqueName="column1" SortExpression="Sex">  
                </telerik:GridBoundColumn>  
                <telerik:GridBoundColumn DataField="Age" DataType="System.Int32" HeaderText="Age" 
                    SortExpression="Age" UniqueName="column2">  
                </telerik:GridBoundColumn>  
            </Columns>  
        </MasterTableView>  
        <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">  
            <Selecting AllowRowSelect="True"></Selecting>  
            <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True" 
                ResizeGridOnColumnResize="False"></Resizing>  
        </ClientSettings>  
        <GroupingSettings ShowUnGroupButton="true" />  
    </telerik:RadGrid> 

In the server side,  a  List<Person> object is binded to the Grid.
There are 3 properties in Person.
public class Person  
{  
    public String Name { getset; }  
    public int Age { getset; }  
    public SexEnum Sex { getset; }  
}  
 
public enum SexEnum  
{  
    Male,  
    Female  
 Anybody can help me?

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 02 Sep 2009, 05:21 PM
Hi Michael,

I followed your scenario in order to replicate the issue you are facing but to no avail. Please find attached a simple runnable application that demonstrates the desired functionality. Give it a try and let me know what is the difference in your scenario.

I hope this helps.

Greetings,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Michael Tao
Top achievements
Rank 1
answered on 03 Sep 2009, 02:45 AM
Hi:
  It seems I still can't resolve this problem.  BTW, my IE version is 7. Does it have something related with this issue?
  And another difference i have found is that my datasource is List<T> while yours is DataTable.

  I don't find the button to upload the attachment. Hence i just upload my source code to my skydrive.
  Please check it and let me know what's wrong with it. Thank you.
http://cid-12c60bb074c4d41a.skydrive.live.com/self.aspx/.Public/Michael.Telerik.Grid.rar
0
Accepted
Pavlina
Telerik team
answered on 08 Sep 2009, 02:48 PM
Hello Michael,

When the grid is in custom paging mode all operations like filtering, sorting & grouping will be applied for the entire data source by default however you can control this at your business objects collection level if you return only needed data.
Please check this example for more info:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/custompaging/defaultcs.aspx

Kind regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Michael Tao
Top achievements
Rank 1
answered on 10 Sep 2009, 02:39 AM
Hi Pavlina:
  Thank you for your reply. It seems that the grid needs to be rebinded after the group/ungroup action if the grid is in custom paging mode.
Tags
Grid
Asked by
Michael Tao
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Michael Tao
Top achievements
Rank 1
Share this question
or