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

Set <asp:Label> Text in code Behind

3 Answers 108 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jérémy
Top achievements
Rank 1
Jérémy asked on 10 Aug 2015, 02:38 PM

Hi !

 

I want set a text of a label in the "OnInit" methode of the .cs page. Is it possible ?

 

...
<telerik:RadComboBox runat="server" ID="RadComboBoxPerimetre" ​...>
  <HeaderTemplate>
    <table style="width:100%">
     <tr>
      <td>
        <asp:Label runat="server" ID="​test"></asp:Label>
      </td>
    </tr>
  </table>
</HeaderTemplate>​
...

 

thanks

3 Answers, 1 is accepted

Sort by
0
Jérémy
Top achievements
Rank 1
answered on 10 Aug 2015, 02:40 PM
Because actually, I haven't access to the "test" object
0
Accepted
Ivan Danchev
Telerik team
answered on 13 Aug 2015, 08:20 AM
Hello,

The following code snippet demonstrates how you can set the Text property of a Label embedded in a RadComboBox header template in the Page_Init handler:
protected void Page_Init(object sender, EventArgs e)
{
    Label label = RadComboBoxPerimetre.Header.FindControl("test") as Label;
    label.Text = "Set in Page_Init";
}

Regards,
Ivan Danchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jérémy
Top achievements
Rank 1
answered on 13 Aug 2015, 09:52 AM

Thanks a lot !

It works !

Tags
ComboBox
Asked by
Jérémy
Top achievements
Rank 1
Answers by
Jérémy
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or