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

get subitem value in radlistview items

1 Answer 149 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Baris
Top achievements
Rank 1
Baris asked on 10 Mar 2014, 09:07 AM
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?





1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 13 Mar 2014, 09:24 AM
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.

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