This is a migrated thread and some comments may be shown as answers.

ListView - DataGrouping with multiple DataKeyNames

1 Answer 131 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Loyal User
Top achievements
Rank 1
Loyal User asked on 05 Mar 2014, 10:10 AM
hi,
i use this demo  for my issue ,
it works fine ,
but i want to use 2 datakeyNames :

<DataGroupTemplate>
   <asp:Panel runat="server" ID="Panel3" CssClass="dataGroup" GroupingText='<%# (Container as RadListViewDataGroupItem).DataGroupKey %>'>
      <asp:Image ID="CarImage" runat="server" AlternateText="Car Image" CssClass="car_brand_img" ImageUrl='<%# "Img/" + (Container as RadListViewDataGroupItem).DataGroupKey + ".png" %>' />
         <asp:PlaceHolder runat="server" ID="DataGroupPlaceHolder3">/asp:PlaceHolder>
<asp:Label runat="server" ID="Label39" CssClass="groupFooter clearfix" Text='<%# "Lower booking price: " + (Container as RadListViewDataGroupItem).AggregatesValues["Price"].ToString() %>'>
</asp:Label>
</asp:Panel>
</DataGroupTemplate>

my changes :
DataKeyNames="ID,NAME"

my question is :  how to use (Container as RadListViewDataGroupItem).DataGroupKey to specify each DataKeyNames ??
 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 10 Mar 2014, 09:13 AM
Hello,

I'm afraid it is not possible to pass multiple data evaluations in single DataGroupItem. The DataKeyNames property determines the fields which you can access via  RadListViewDataItem:
string value = (container as RadListViewDataItem).GetDataKeyValue("Name");
 
With RadListViewDataGroupItem you can only get the DataGroupKey, which is the corresponding value of the field used for grouping:
<telerik:ListViewDataGroup ... GroupField="BrandName" >

I hope the clarification was helpful.

Regards,
Eyup
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Tags
ListView
Asked by
Loyal User
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or