I'm using a RadGrid control along with the RadToolTipManager control. If you click on the row header it sorts correctly. if you click on it again, it resorts in the opposite direction. However, if you click on the up/down resort image instead it fails with an "invalid postback or callback argument" error.
I've tried explicitly setting the sort expression, but it doesn't seem to help. Here's a sample of how it's configured:
Here's what the various bound events look like:
Any ideas about why this isn't working?
I've tried explicitly setting the sort expression, but it doesn't seem to help. Here's a sample of how it's configured:
<telerik:RadGrid ID="grdScoreCard" runat="server" |
onneeddatasource="grdScoreCard_NeedDataSource" EnableViewState="False" |
OnItemCommand="grdScoreCard_ItemCommand" |
AutoGenerateColumns="False" GridLines="None" |
onitemdatabound="grdScoreCard_ItemDataBound" AllowSorting="True"> |
<headercontextmenu enabletheming="True"> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</headercontextmenu> |
<mastertableview showfooter="True" AllowMultiColumnSorting="true" AllowSorting="true"> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px"></HeaderStyle> |
</RowIndicatorColumn> |
<ExpandCollapseColumn> |
<HeaderStyle Width="20px"></HeaderStyle> |
</ExpandCollapseColumn> |
<Columns> |
<telerik:GridTemplateColumn> |
<ItemTemplate> |
<asp:HyperLink ID="lnkInfo" Text="Details" ToolTip="Info" NavigateUrl="#" runat="server"></asp:HyperLink> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="AvgContractAmount" DataFormatString="{0:c}" |
HeaderText="Avg. Contract $" |
SortExpression="AvgContractAmount" |
UniqueName="colAvgContractAmount" Aggregate="Sum" FooterAggregateFormatString="{0:0,0}"> |
<FooterStyle HorizontalAlign="Right" /> |
<ItemStyle HorizontalAlign="Right" /> |
</telerik:GridBoundColumn> |
Here's what the various bound events look like:
protected void btnGenerate_Click(object sender, EventArgs e) |
{ |
this.grdScoreCard.Rebind(); |
} |
protected void grdScoreCard_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
{ |
if (e.CommandName == "Sort" || e.CommandName == "Page") |
{ |
this.RadToolTipManager1.TargetControls.Clear(); |
} |
} |
protected void grdScoreCard_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
{ |
this.Generate(); |
} |
protected void Generate() |
{ |
DataTable table = this.GenerateData(); |
this.grdScoreCard.DataSource = table; |
} |
protected void grdScoreCard_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem) |
{ |
HyperLink link = e.Item.FindControl("lnkInfo") as HyperLink; |
if (link != null) |
{ |
DataRowView view = (DataRowView)e.Item.DataItem; |
this.RadToolTipManager1.TargetControls.Add(link.ClientID, view.Row["LocationID"].ToString(), true); |
} |
} |
if (e.Item is Telerik.Web.UI.GridDataItem) |
{ |
Telerik.Web.UI.GridDataItem item = e.Item as Telerik.Web.UI.GridDataItem; |
if (item != null) |
{ |
int index = e.Item.ItemIndex + 1; |
item["colRank"].Text = index.ToString(); |
} |
} |
if (e.Item is Telerik.Web.UI.GridFooterItem) |
{ |
DataTable table = this.grdScoreCard.DataSource as DataTable; |
this.GenerateFooter(e, table); |
} |
} |
Any ideas about why this isn't working?