Hi there,
I got a wierd problem on RadGrid when using inside a dynamically loaded (using LoadControl) Usercontrol. the sorting not seems to work properly. I intially got this error
$WebAnalytics$ReportViewer1$GeneralSummary1$rgGeneralSummary$ctl01$ctl02$ctl01$ctl03' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
I am using the NeedDataSource to assign the datasource (without calling databind). Here is the declaration of the RadGrid.
<rad:RadGrid ID="rgGeneralSummary" runat="server" GridLines="None" AllowPaging="True"ShowStatusBar="true" PageSize="20" RadControlsDir="~/Resources/RadControls/" Skin="WebBlue" SkinID="WebBlue" SkinsPath="~/Resources/RadControls/Grid/Skins" AllowSorting="True" CellSpacing="10" CellPadding="5" AllowFilteringByColumn="false" ShowGroupPanel="True" Width="650px" AutoGenerateColumns="False" EnableAJAX="true" EnableAJAXLoadingTemplate="true" Height="250px" OnNeedDataSource="rgGeneralSummary_NeedDataSource">
<ClientSettings AllowDragToGroup="False">
<Scrolling AllowScroll="True" UseStaticHeaders="True" /></ClientSettings>
<PagerStyle PagerTextFormat="<strong>{5} Records</strong>. Change page: {4} &nbsp;|&nbsp; Displaying page {0} of {1}, items {2} to {3} of {5}." />
<MasterTableView AutoGenerateColumns="False" AllowFilteringByColumn="false" DataSourcePersistenceMode="ViewState">
<Columns>
<rad:GridBoundColumn DataField="Period" DataType="System.String" HeaderText="Period" SortExpression="Period" UniqueName="Period" ItemStyle-Width="130px" HeaderStyle-Width="130px">
</rad:GridBoundColumn>
<rad:GridBoundColumn DataField="PageViews" DataType="System.Int32" HeaderText="PageViews"ItemStyle-Width="130px" HeaderStyle-Width="130px" ReadOnly="True" SortExpression="PageViews" UniqueName="PageViews">
</rad:GridBoundColumn>
<rad:GridBoundColumn DataField="Sessions" DataType="System.Int32" HeaderText="Sessions"ItemStyle-Width="130px" ReadOnly="True" HeaderStyle-Width="130px" SortExpression="Sessions" UniqueName="Sessions">
</rad:GridBoundColumn>
<rad:GridBoundColumn DataField="UniqueVisitors" DataType="System.Int32" HeaderText="Unique Visitors"
ItemStyle-Width="130px" HeaderStyle-Width="130px" ReadOnly="True" SortExpression="UniqueVisitors" UniqueName="UniqueVisitors">
</rad:GridBoundColumn>
<rad:GridBoundColumn DataField="ViewsPerSession" DataType="System.Decimal" HeaderText="Page views per session" ItemStyle-Width="130px" HeaderStyle-Width="130px" ReadOnly="True" SortExpression="ViewsPerSession" UniqueName="ViewsPerSession">
</rad:GridBoundColumn>
</Columns>
</MasterTableView>
</rad:RadGrid>
Later i checked this post and introduced ItemCreated to set the Header links Id. This avoids the exception but issue still there. The sorting works fine in ascending order but the decending order is not working.
Please help me to fix this sorting issue.