Find Item Control in RadListView Client Side

3 posts, 0 answers
  1. rahul
    rahul avatar
    27 posts
    Member since:
    Mar 2014

    Posted 09 Apr 2014 Link to this post

    Hi,

    I want to find a check_box_list controls check_box count in Rad_list_view on client side. how can get it.
    please provide solutions.
    My code as follows
    <telerik:RadListView runat="server"  ID="RadListView1" BorderColor="White" onitemdatabound="RadListView1_ItemDataBound" BorderStyle="None" AllowPaging="True">
            <ClientSettings></ClientSettings>          
             <ItemTemplate>
                        <div style="border-bottom:1px solid gray;padding-left:15px;">   
                              <table cellpadding="2px" cellspacing="2px" border="0">                                                                   
                                            <tr>                                                                    
                                            <td class="LabelWidth" style="margin-left:2%; vertical-align:middle;font-family: Georgia,serif;">
                                                     <asp:Label ID="Label4" runat="server" Text='<%# (DataBinder.Eval(Container.DataItem,"PermissionItemName")) %>'></asp:Label>
                                         </td>
                                                                          
                                         <td>    </td>
                                          <td valign="middle">
                                                 <asp:CheckBoxList  ID="Listbox_Permission" CellSpacing="10" CellPadding="5"  runat="server" RepeatDirection="Horizontal" CssClass="CheckboxList" AutoPostBack="false" >
                                                   </asp:CheckBoxList>        
                                                                              
                                           </td>
                                      </tr>                                        
                             </table>
                       </div>
                     </ItemTemplate>
                </telerik:RadListView>

    Thanks,
    Rahul
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Apr 2014 in reply to rahul Link to this post

    Hi Rahul,

    As a work around please try the following JavaScript to access the CheckBoxList.

    JavaScript:
    var CheckboxList = document.getElementsByClassName('CheckboxList');

    Thanks,
    Princy.
  3. Eyup
    Admin
    Eyup avatar
    3210 posts

    Posted 14 Apr 2014 Link to this post

    Hi Rahul,

    Alternatively, you can use the following approach:
    <ItemTemplate>
        <div ... id='<%# "ListViewItemDiv"+Container.DisplayIndex %>'>
    JavaScript:
    function buttonClick() {
        // accessing the checked values of the fifth item
        var index = 4;
        var itemEl = $get("ListViewItemDiv" + index);
        var checkBoxList = $telerik.findElement(itemEl, "Listbox_Permission");
        var checked = $(checkBoxList).find(":checked");
     
        // execute custom logic with the checked collection
        for (var i = 0; i < checked.length; i++) {
            alert(checked[i].value);
        }
    }

    Hope this helps.

    Regards,
    Eyup
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top