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">
                                        <ItemTemplate>
                                            <table>
                                                <tr>
                                                    <td >
                                                        <asp:CheckBoxList ID="cbID" runat="server" CssClass="item" Font-Size="15px" RepeatDirection="Horizontal">
                                                            <asp:ListItem Text="    "  > </asp:ListItem>
                                                        </asp:CheckBoxList></td>
                                                    <td style="padding-bottom:10px"><%# Eval("FirstName") %></td>
                                                    <td style="padding-bottom:10px"><%# Eval("FamilyName") %></td>
                                                </tr>
                                            </table>
                                        </ItemTemplate>
     </telerik:RadListView>

    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
    Admin
    Eyup avatar
    3015 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:
    http://www.telerik.com/help/aspnet-ajax/listview-accessing-controls.html

    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:
    http://www.telerik.com/help/aspnet-ajax/listview-differences-between-itemcreated-itemdatabound-events.html

    Hope this helps.

    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