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

Label control in RadListBox

1 Answer 116 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Janaki
Top achievements
Rank 1
Janaki asked on 17 Jul 2012, 09:16 AM
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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 17 Jul 2012, 09:35 AM
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.
Tags
ListBox
Asked by
Janaki
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or