Hello,
I have a small question, about the SortExpression in a GridTemplateColumn.
In fact, I have a SQL table [Action] and a table [PlanActionNiveauDeRealisation]. Like this an [Action] can have a lot of [PlanActionNiveauDeRealisation].
So, I put a RadGrid with all my [Actions] and in the last columns I put this :
In the ItemDataBound, I put :
Like this, it's perfect, I have a nice RadGrid with the last [PlanActionNiveauDeRealisation] of each [action].
Just, I would like to make some sorting with this last column : [lastNiveau], but i dunno what to put in the SortExpression...
Do you have any idea?
Thank you
I have a small question, about the SortExpression in a GridTemplateColumn.
In fact, I have a SQL table [Action] and a table [PlanActionNiveauDeRealisation]. Like this an [Action] can have a lot of [PlanActionNiveauDeRealisation].
So, I put a RadGrid with all my [Actions] and in the last columns I put this :
<telerik:GridTemplateColumn UniqueName="LastNiveau" HeaderText="Niveau de réalisation" > <ItemTemplate> <telerik:RadRating ID="ratingBar" runat="server" Orientation="Horizontal" ItemHeight="61px" ItemWidth="11px" CssClass="ratingClass" OnRate="ratingBar_Rate" AutoPostBack="true"> <Items> <telerik:RadRatingItem Value="0" HoveredImageUrl="/images/Rating/Rating1/2h.png" HoveredSelectedImageUrl="/images/Rating/Rating1/2h.png" SelectedImageUrl="/images/Rating/Rating1/2s.png" ImageUrl="/images/Rating/Rating1/2.png" ToolTip="0 %" /> <telerik:RadRatingItem Value="25" HoveredImageUrl="/images/Rating/Rating1/3h.png" HoveredSelectedImageUrl="/images/Rating/Rating1/3h.png" SelectedImageUrl="/images/Rating/Rating1/3s.png" ImageUrl="/images/Rating/Rating1/3.png" ToolTip="25 %" /> <telerik:RadRatingItem Value="50" HoveredImageUrl="/images/Rating/Rating1/4h.png" HoveredSelectedImageUrl="/images/Rating/Rating1/4h.png" SelectedImageUrl="/images/Rating/Rating1/4s.png" ImageUrl="/images/Rating/Rating1/4.png" ToolTip="50 %" /> <telerik:RadRatingItem Value="75" HoveredImageUrl="/images/Rating/Rating1/5h.png" HoveredSelectedImageUrl="/images/Rating/Rating1/5h.png" SelectedImageUrl="/images/Rating/Rating1/5s.png" ImageUrl="/images/Rating/Rating1/5.png" ToolTip="75 %" /> <telerik:RadRatingItem Value="100" HoveredImageUrl="/images/Rating/Rating1/6h.png" HoveredSelectedImageUrl="/images/Rating/Rating1/6h.png" SelectedImageUrl="/images/Rating/Rating1/6s.png" ImageUrl="/images/Rating/Rating1/6.png" ToolTip="100 %" /> </Items> </telerik:RadRating> </ItemTemplate> </telerik:GridTemplateColumn>In the ItemDataBound, I put :
protected void RGPlanAction_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { var maxLength = 50; var dataItem = e.Item as GridDataItem; var myPlanAction = (Model.PlanAction)e.Item.DataItem; var myRadRating = (RadRating) dataItem["LastNiveau"].FindControl("ratingBar"); myRadRating.Attributes.Add("IdPlanAction", myPlanAction.IdPlanAction.ToString()); myRadRating.Attributes.Add("IndexRadGrid", e.Item.ItemIndex.ToString()); var ndr = myPlanAction.PlanActionNiveauDeRealisation.LastOrDefault(); if(ndr != null) { myRadRating.Value = ndr.NiveauDeRealisation; } else { myRadRating.Value = 0; } } }Like this, it's perfect, I have a nice RadGrid with the last [PlanActionNiveauDeRealisation] of each [action].
Just, I would like to make some sorting with this last column : [lastNiveau], but i dunno what to put in the SortExpression...
Do you have any idea?
Thank you