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

hide label

1 Answer 204 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 27 Feb 2012, 10:43 AM
How to access the label control and hide it in a button click?
aspx:
<telerik:RadListBox runat="server" ID="listbox1_source" Height="200px"
           Width="230px" CheckBoxes="true"
ButtonSettings-ShowTransferAll="true"
           onitemdatabound="rdLstSource_ItemDataBound">
                       <ItemTemplate>
                           <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                       </ItemTemplate>
                       
                   </telerik:RadListBox>

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Feb 2012, 11:21 AM
Hello Tina,

Try the following code.
C#:
protected void Button1_Click(object sender, EventArgs e)
{
 foreach (RadListBoxItem item in listbox1_source.Items)
 {
  Label label1 = (Label)item.FindControl("Label1");
  label1.Visible = false;
 }       
}

-Shinu.
Tags
General Discussions
Asked by
Tina
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or