Label control in RadListBox

2 posts, 1 answers
  1. Janaki
    Janaki avatar
    27 posts
    Member since:
    Mar 2012

    Posted 17 Jul 2012 Link to this post

    Hi all,

        I have a RadListBox, in that I need to access the  label control. Also I need to hide the same in a button click.How can I do this?

    Please find the code

        <telerik:RadListBox runat="server" ID="RadList_1" Height="150px" Width="180px" CheckBoxes="true"
               ButtonSettings-ShowTransferAll="true" onitemdatabound="RadList_1_ItemDataBound">
                           <ItemTemplate>
                               <asp:Label ID="lblTest" runat="server" Text="Test"></asp:Label>
                           </ItemTemplate>                    
                       </telerik:RadListBox>


    Thanks in advance.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 17 Jul 2012 Link to this post

    Hi Janaki,

    Try the following code snippet to access and hide the label in button click.

    C#:
    protected void Button1_Click(object sender, EventArgs e)
     {
       foreach (RadListBoxItem item in RadList_1.Items)
         {
           Label label1 = (Label)item.FindControl("lblTest");
           label1.Visible = false;
         }   
     }

    Hope this helps.

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