Hi,
I have a grid. Fields in the grid allow to sort only in two ways(ascending, descending). But for the first time load I want it to show sorting based on first column. I read an article at http://www.telerik.com/help/aspnet-ajax/grdsortingexpressions.html. This is not working. Below is code sample, do let me know if some thing else needs to be done.
<rad:RadGrid ID="RegularActGrid" AllowPaging="true" Skin="Vista" AllowSorting="true" OnPageIndexChanged="RegularActGrid_PageIndexChanged" OnNeedDataSource="RegularActGrid_NeedDataSource" OnSortCommand="RegularActGrid_SortCommand" EnableEmbeddedSkins="false" runat="server" Width="100%" AutoGenerateColumns="False">
<PagerStyle Visible="false"/>
<MasterTableView PageSize="10" AllowPaging="true" AllowCustomPaging="true" AllowCustomSorting="true" AllowNaturalSort="false" AllowSorting="true" EnableNoRecordsTemplate="true">
<NoRecordsTemplate >
</NoRecordsTemplate>
<SortExpressions>
<rad:GridSortExpression FieldName="ActivityName" SortOrder="Ascending" />
</SortExpressions>
<Columns>
<rad:GridTemplateColumn SortExpression="0" HeaderText="<%$ Resources:L_LMS_Activity_ExceptionDetails, Info_ColEmpName%>" UniqueName="ActivityName">
<ItemStyle VerticalAlign="Middle"/>
<ItemTemplate>
<asp:Label runat="server" ToolTip='<%# GetName(Eval("EmployeeFName"), Eval("EmployeeLName"), Eval("EmployeeMI"))%>' Text='<%# GetName(Eval("EmployeeFName"), Eval("EmployeeLName"), Eval("EmployeeMI"))%>'></asp:Label>
</ItemTemplate>
</rad:GridTemplateColumn>
<rad:GridTemplateColumn SortExpression="1" UniqueName="EmpIdentifier">
<ItemStyle/>
<ItemTemplate>
<asp:Label runat="server" ToolTip='<%# Eval(this.g_strEmpIdentifierRSName)%>' Text='<%# Eval(this.g_strEmpIdentifierRSName)%>'></asp:Label>
</ItemTemplate>
</rad:GridTemplateColumn>
<rad:GridTemplateColumn SortExpression="4" HeaderText="<%$ Resources:L_LMS_Activity_ExceptionDetails, Info_ColAssignment%>" UniqueName="RequiredIncomplete">
<ItemStyle/>
<ItemTemplate>
<asp:Label runat="server" ToolTip='<%# GetColData(Eval(this.g_strCol1),0)%>' Text='<%# GetColData(Eval(this.g_strCol1),0)%>'></asp:Label>
</ItemTemplate>
</rad:GridTemplateColumn>
<rad:GridTemplateColumn SortExpression="2" HeaderText="<%$ Resources:L_LMS_Activity_ExceptionDetails, Info_DueDate%>" UniqueName="RecommendedIncomplete">
<ItemStyle/>
<ItemTemplate>
<asp:Label runat="server" ToolTip='<%# GetColData(Eval(this.g_strCol2), 1)%>' Text='<%# GetColData(Eval(this.g_strCol2),1)%>'></asp:Label>
</ItemTemplate>
</rad:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="true" EnableVirtualScrollPaging="true" UseStaticHeaders="true" />
<Selecting AllowRowSelect="True"></Selecting>
<Resizing AllowColumnResize="true" />
</ClientSettings>
</rad:RadGrid>
I have a grid. Fields in the grid allow to sort only in two ways(ascending, descending). But for the first time load I want it to show sorting based on first column. I read an article at http://www.telerik.com/help/aspnet-ajax/grdsortingexpressions.html. This is not working. Below is code sample, do let me know if some thing else needs to be done.
<rad:RadGrid ID="RegularActGrid" AllowPaging="true" Skin="Vista" AllowSorting="true" OnPageIndexChanged="RegularActGrid_PageIndexChanged" OnNeedDataSource="RegularActGrid_NeedDataSource" OnSortCommand="RegularActGrid_SortCommand" EnableEmbeddedSkins="false" runat="server" Width="100%" AutoGenerateColumns="False">
<PagerStyle Visible="false"/>
<MasterTableView PageSize="10" AllowPaging="true" AllowCustomPaging="true" AllowCustomSorting="true" AllowNaturalSort="false" AllowSorting="true" EnableNoRecordsTemplate="true">
<NoRecordsTemplate >
</NoRecordsTemplate>
<SortExpressions>
<rad:GridSortExpression FieldName="ActivityName" SortOrder="Ascending" />
</SortExpressions>
<Columns>
<rad:GridTemplateColumn SortExpression="0" HeaderText="<%$ Resources:L_LMS_Activity_ExceptionDetails, Info_ColEmpName%>" UniqueName="ActivityName">
<ItemStyle VerticalAlign="Middle"/>
<ItemTemplate>
<asp:Label runat="server" ToolTip='<%# GetName(Eval("EmployeeFName"), Eval("EmployeeLName"), Eval("EmployeeMI"))%>' Text='<%# GetName(Eval("EmployeeFName"), Eval("EmployeeLName"), Eval("EmployeeMI"))%>'></asp:Label>
</ItemTemplate>
</rad:GridTemplateColumn>
<rad:GridTemplateColumn SortExpression="1" UniqueName="EmpIdentifier">
<ItemStyle/>
<ItemTemplate>
<asp:Label runat="server" ToolTip='<%# Eval(this.g_strEmpIdentifierRSName)%>' Text='<%# Eval(this.g_strEmpIdentifierRSName)%>'></asp:Label>
</ItemTemplate>
</rad:GridTemplateColumn>
<rad:GridTemplateColumn SortExpression="4" HeaderText="<%$ Resources:L_LMS_Activity_ExceptionDetails, Info_ColAssignment%>" UniqueName="RequiredIncomplete">
<ItemStyle/>
<ItemTemplate>
<asp:Label runat="server" ToolTip='<%# GetColData(Eval(this.g_strCol1),0)%>' Text='<%# GetColData(Eval(this.g_strCol1),0)%>'></asp:Label>
</ItemTemplate>
</rad:GridTemplateColumn>
<rad:GridTemplateColumn SortExpression="2" HeaderText="<%$ Resources:L_LMS_Activity_ExceptionDetails, Info_DueDate%>" UniqueName="RecommendedIncomplete">
<ItemStyle/>
<ItemTemplate>
<asp:Label runat="server" ToolTip='<%# GetColData(Eval(this.g_strCol2), 1)%>' Text='<%# GetColData(Eval(this.g_strCol2),1)%>'></asp:Label>
</ItemTemplate>
</rad:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="true" EnableVirtualScrollPaging="true" UseStaticHeaders="true" />
<Selecting AllowRowSelect="True"></Selecting>
<Resizing AllowColumnResize="true" />
</ClientSettings>
</rad:RadGrid>