Set <asp:Label> Text in code Behind

4 posts, 1 answers
  1. Jérémy
    Jérémy avatar
    19 posts
    Member since:
    Feb 2015

    Posted 10 Aug 2015 Link to this post

    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

  2. Jérémy
    Jérémy avatar
    19 posts
    Member since:
    Feb 2015

    Posted 10 Aug 2015 in reply to Jérémy Link to this post

    Because actually, I haven't access to the "test" object
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    835 posts

    Posted 13 Aug 2015 Link to this post

    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
  5. Jérémy
    Jérémy avatar
    19 posts
    Member since:
    Feb 2015

    Posted 13 Aug 2015 in reply to Ivan Danchev Link to this post

    Thanks a lot !

    It works !

Back to Top