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">
                               <asp:Label ID="lblTest" runat="server" Text="Test"></asp:Label>

    Thanks in advance.
  2. Answer
    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.

    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.

  3. DevCraft R3 2016 release webinar banner
Back to Top