Label AutoHeight in code behind

  1. #1

    Label AutoHeight in code behind


    I am trying to get a label to wrap long text to multiple lines.

    In the declarative syntax I am able to accomplish this with AutoHeight="true".

    <ext:Label ID="Label1" runat="server"  Width="600px" AutoHeight="true"  Text="long text......."/>
    However, I have not found any equivalent method or property that would set AutoHeight to true if I create the label dynamically..
    Ext.Net.Label label = new Ext.Net.Label();
    Please let me know where I should look.

    Last edited by Daniil; May 30, 2015 at 3:04 PM.
  2. #2
    Hi @rbabutin,

    Welcome to the Ext.NET forums!

    Hmm, does AutoHeight="true" work? I would expect it doesn't.

    Though, if it works decoratively, then this code behind counterpart should be working as well. Does it work for you?
    Please try with
    Ext.Net.Label label = new Ext.Net.Label
        CustomConfig =
            new ConfigItem
                Name = "autoHeight",
                Value = "true",
                Mode = ParameterMode.Raw
  3. #3
    Hi @Daniil, you are right. Label AutoHeight="true" does not work neither declaratively nor with code behind... Instead, to be able to control the line breaks of the label I used its Html property.

    Thank you!

Similar Threads

  1. [CLOSED] Set label.Html from code behind
    By MarcA in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 18, 2013, 3:32 PM
  2. [CLOSED] How to change text of a label from code behind
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 20
    Last Post: Oct 05, 2012, 7:28 AM
  3. Replies: 2
    Last Post: Oct 04, 2012, 10:14 AM
  4. [CLOSED] Html code to Ext:label
    By canbay in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 26, 2012, 1:08 PM
  5. label autoheight
    By mahabub in forum 2.x Help
    Replies: 2
    Last Post: Apr 19, 2012, 8:05 PM

Posting Permissions