[CLOSED] Label in CompositeField issue

  1. #1

    [CLOSED] Label in CompositeField issue

    Hi,

    I have a Label control inside a FormPanel's CompositeField to display some read-only data. I need to assign the Text property of the Label in Combo's Select DirectEvent. There's no error in runtime, however, the label remains empty. If I add a TextField control alongside the Label and assign Text for both, then both become populated correctly. Please advise.

        <ext:FormPanel ID="FormPanel1" runat="server">
            <Items>
                <ext:CompositeField runat="server" FieldLabel="My Test">
                    <Items>
                        <ext:Label runat="server" ID="Label1"></ext:Label>
                        <%--<ext:TextField ID="Text1" runat="server"></ext:TextField>--%>
                    </Items>
                </ext:CompositeField>
            </Items>
        </ext:FormPanel>
            protected void Combo1_Select(object sender, DirectEventArgs e)
            {
                 this.Label1.Text="Something in the Label";
                 // this.Text1.Text="Something in the TextField";
            }
    Thanks,

    Vadym
    Last edited by Daniil; Apr 12, 2012 at 5:24 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I can suggest to set up:
    Text="&nbsp;"
    for the Label to fix the problem.
  3. #3
    Hi Daniil,

    That hasn't fixed it. Until I explicitly assign the TextField Text property, the Label is not visible. BTW, the same issue affects the DisplayField control under the circumstances I've described.

    Thanks,

    Vadym
  4. #4
    I'm testing with the following example. It appears to be working.

    Please provide your test case.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void SetText(object sender, DirectEventArgs e)
        {
            this.DisplayField1.Text = "Something in the Label";
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:FormPanel runat="server">
                <Items>
                    <ext:CompositeField runat="server" FieldLabel="My Test">
                        <Items>
                            <ext:DisplayField ID="DisplayField1" runat="server"  Text="&nbsp;" />
                        </Items>
                    </ext:CompositeField>
                </Items>
            </ext:FormPanel>
            <ext:Button runat="server" Text="Test" OnDirectClick="SetText" />
        </form>
    </body>
    </html>
  5. #5
    I've just realized that one important difference in my setup is that the FormPanel has Hidden="true" in the markup. I'm setting it to "false" in the DirectEvent and then assigning the Text property of the Label control (not working properly). I've just tried to remove the Hidden attribute from the FormPanel, and suddenly everything is clicking fine. Is there any way to still have the FormPanel hidden initially and have the Label work? Or is there any suggestion how to meet the requirements?

    <%@ Page Language="C#" %>
      
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <script runat="server">
        protected void SetText(object sender, DirectEventArgs e)
        {
            this.FormPanel1.Hidden = false;
            this.DisplayField1.Text = "Something in the Label";
        }
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:FormPanel ID="FormPanel1" Hidden="true" runat="server">
                <Items>
                    <ext:CompositeField ID="CompositeField1" runat="server" FieldLabel="My Test">
                        <Items>
                            <ext:DisplayField ID="DisplayField1" runat="server"  Text="&nbsp;" />
                        </Items>
                    </ext:CompositeField>
                </Items>
            </ext:FormPanel>
            <ext:Button ID="Button1" runat="server" Text="Test" OnDirectClick="SetText" />
        </form>
    </body>
    </html>
    Thanks,

    Vadym
  6. #6
    I would try to set up
    HideMode="Offsets"
    for the FormPanel.

    HBoxLayout (default one of CompositeField) doesn't like hidden items.
  7. #7
    Or you can just call the FormPanel DoLayout method.
    this.FormPanel1.Hidden = false;
    this.DisplayField1.Text = "Something in the Label";
    this.FormPanel1.DoLayout();
    In this case you can remove
    Text="&nbsp;"
    and
    HideMode="Offsets"
  8. #8
    Quote Originally Posted by Daniil View Post
    Or you can just call the FormPanel DoLayout method.
    this.FormPanel1.Hidden = false;
    this.DisplayField1.Text = "Something in the Label";
    this.FormPanel1.DoLayout();
    In this case you can remove
    Text="&nbsp;"
    and
    HideMode="Offsets"
    this.FormPanel1.DoLayout();

    I like this suggestion the most to work around the issue. Thanks a bunch for your help! You can mark this thread as resolved.

    Thanks,

    Vadym

Similar Threads

  1. Replies: 2
    Last Post: Sep 13, 2011, 11:39 PM
  2. CompositeField StyleSpec issue
    By joao.msdn in forum 1.x Help
    Replies: 0
    Last Post: Jan 07, 2011, 1:07 PM
  3. [CLOSED] IE8 render issue for CompositeField
    By asztern in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 30, 2010, 3:22 PM
  4. [CLOSED] Aligning label of textfield in compositefield to left of control
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 20, 2010, 2:27 PM
  5. [CLOSED] [1.0] CompositeField and SyncSize() issue
    By pasion in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 29, 2010, 1:55 PM

Posting Permissions