get subitem value in radlistview items

2 posts, 0 answers
  1. Baris
    Baris avatar
    34 posts
    Member since:
    Jul 2013

    Posted 10 Mar 2014 Link to this post

    here is my listview

    <telerik:RadListView runat="server" ID="lvAllUsers" Width="30px">
                                                    <td >
                                                        <asp:CheckBoxList ID="cbID" runat="server" CssClass="item" Font-Size="15px" RepeatDirection="Horizontal">
                                                            <asp:ListItem Text="    "  > </asp:ListItem>
                                                    <td style="padding-bottom:10px"><%# Eval("FirstName") %></td>
                                                    <td style="padding-bottom:10px"><%# Eval("FamilyName") %></td>

    how can I get checkboxlists item text at code behind ? or how can I get FirstName and FamilyName and code behind after I binded my data at pageload? I can't use
         foreach (Telerik.Web.UI.RadListViewItem item in lvAllUsers.Items)
                    var cb = item.FindControl(index);
     because index is equals an id normally. But in item template id is not always cbID. When item template iteratives id is changing. I need get FirstName and FamilyName or checkboxlists item at codebehind (c# only not js). How can I do that?

  2. Eyup
    Eyup avatar
    3647 posts

    Posted 13 Mar 2014 Link to this post

    Hello Baris,

    You can use the FindControl method to access the controls in code-behind using their IDs:

    In case the IDs are not known beforehand, you can use Recursion to traverse the Controls collection of the e.Item in the ItemCreated or ItemDataBound:

    Hope this helps.


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

Back to Top