ListView - DataGrouping with multiple DataKeyNames

2 posts, 0 answers
  1. Loyal User
    Loyal User avatar
    37 posts
    Member since:
    Apr 2012

    Posted 05 Mar 2014 Link to this post

    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 ??
     
  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 10 Mar 2014 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top