I have added an Ajax rating control to my Gridview as below:
<asp:BoundField DataField="Wrms_QueryId" HeaderText="Warms_QueryId" ReadOnly="True" SortExpression="Wrms_QueryId" />
<asp:TemplateField HeaderText="Favourites">
<ItemTemplate>
<asp:Rating ID="Rating1" runat="server" AutoPostBack="true" CurrentRating='<%# Bind("num") %>' MaxRating="3" RatingAlign="Horizontal"
RatingDirection="LeftToRightTopToBottom" StarCssClass="ratingStar" WaitingStarCssClass="savedRatingStar"
FilledStarCssClass="filledRatingStar" EmptyStarCssClass="emptyRatingStar" Tag='<%# Bind("Wrms_QueryId")%>' OnChanged="Rating1_Changed">
</asp:Rating>
</ItemTemplate>
</asp:TemplateField>
and in .cs
protected void Rating1_Changed(object sender, EventArgs e)
{
Rating ra= (Rating)sender;
GridViewRow gr=(GridViewRow) ra.Parent.Parent;
// table update required?
Rating r = sender as Rating;
int id = Convert.ToInt32(r.Tag);
int lf = Convert.ToInt32(r.CurrentRating);
string strSQL2 = "UPDATE [dbo].[wrms_config_m] set QueryId = " + lf + " where Wrms_QueryId = " + id;
ExecuteSQLUpdate(strSQL2);
}
but I don't know how to add sorting to the rating column. Normally I would just add SortExpression="####" but this doesn't seem to be supported for the rating column.
I have looked through lots of forums and can't find an answer. any help would be gratefully received please.
thanks