[CLOSED] By modifying the value of property 'FieldLabel' content is not held property 'LabelSeparator'

  1. #1

    [CLOSED] By modifying the value of property 'FieldLabel' content is not held property 'LabelSeparator'

    When I change the value of property 'FieldLabel' via codebehind, the contents of the property 'LabelSeparator' disappears.

    The following example:

                                            <ext:CompositeField ID="CompositeField9" runat="server"
                                                                FieldLabel="User" 
                                                                LabelAlign="Right" 
                                                                MsgTarget="Side" 
                                                                Width="227" >
                                                <Items>
                                                    <ext:TextField ID="TextField1" runat="server"
                                                                   FieldLabel="User" 
                                                                   Width="200" >
                                                    </ext:TextField>
                                                </Items>
                                            </ext:CompositeField>                                            
                                            <ext:Button ID="Button3" runat="server" Text="SetFieldLabel" Height="24" Width="103" >
                                                <DirectEvents>
                                                    <Click OnEvent="Button3_Click" >
                                                    </Click>
                                                </DirectEvents>
                                            </ext:Button>
            protected void Button3_Click(object sender, Ext.Net.DirectEventArgs e)
            {
                try
                {
                    CompositeField9.FieldLabel = "Name";
                    TextField1.FieldLabel = "Name";
                }
                catch (Exception ex)
                {
                    Ext.Net.X.Msg.Show(new Ext.Net.MessageBoxConfig
                    {
                        Title = "Test",
                        Message = ex.Message.ToString(),
                        Buttons = Ext.Net.MessageBox.Button.OK,
                        Icon = Ext.Net.MessageBox.Icon.WARNING
                    }
                    );
                }
            }
    Last edited by Daniil; Dec 15, 2011 at 12:20 PM. Reason: [CLOSED]
  2. #2

    By modifying the value of property 'FieldLabel' content is not held property 'LabelSeparator'

    Correcting the title of the thread:

    When I change the value of property 'FieldLabel' via codebehind, the contents of the property 'LabelSeparator' disappears.

    The following example:

            protected void Button3_Click(object sender, Ext.Net.DirectEventArgs e)
            {
                try
                {
                    CompositeField9.FieldLabel = "Name";
                    TextField1.FieldLabel = "Name";
                }
                catch (Exception ex)
                {
                    Ext.Net.X.Msg.Show(new Ext.Net.MessageBoxConfig
                    {
                        Title = "Test",
                        Message = ex.Message.ToString(),
                        Buttons = Ext.Net.MessageBox.Button.OK,
                        Icon = Ext.Net.MessageBox.Icon.WARNING
                    }
                    );
                }
            }
  3. #3
    To override it you can add the following thing into a page's head.
    <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
    
    <script type="text/javascript">
        Ext.Component.override({
            setFieldLabel : function (text) {
                this.fieldLabel = text;
            
                if (this.label) {
                    this.label.update(text + (this.labelSeparator || ":"));
                }
            }
        });
    </script>
    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void ChangeFieldLabel(object sender, DirectEventArgs e)
        {
            this.TextField1.FieldLabel = "New FieldLabel";
        }
    </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>
    
        <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
    
        <script type="text/javascript">
            Ext.Component.override({
                setFieldLabel : function (text) {
                    this.fieldLabel = text;
            
                    if (this.label) {
                        this.label.update(text + (this.labelSeparator || ":"));
                    }
                }
            });
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:FormPanel runat="server">
                <Items>
                    <ext:TextField ID="TextField1" runat="server" FieldLabel="FieldLabel" />    
                </Items>
            </ext:FormPanel>
            
            <ext:Button runat="server" Text="Change FieldLabel" OnDirectClick="ChangeFieldLabel" />
        </form>
    </body>
    </html>
  4. #4
    Finally, we consider it a bug.

    The bug ticket has been created:
    https://extnet.lighthouseapp.com/pro...gs/tickets/235

    The fix has been added to SVN (revision #3793) and will be publicly available in the upcoming v1.3 release.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void ChangeFieldLabel(object sender, DirectEventArgs e)
        {
            this.TextField1.FieldLabel = "New FieldLabel";
        }
    </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:TextField ID="TextField1" runat="server" FieldLabel="FieldLabel" />    
                </Items>
            </ext:FormPanel>
            
            <ext:Button runat="server" Text="Change FieldLabel" OnDirectClick="ChangeFieldLabel" />
        </form>
    </body>
    </html>
    Thanks for the report!

Similar Threads

  1. Replies: 4
    Last Post: Apr 25, 2012, 11:57 AM
  2. [CLOSED] how to set panel html property as javascript property
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 05, 2011, 6:45 PM
  3. [CLOSED] [1.0] Composite field FieldLabel property
    By tansu in forum 1.x Legacy Premium Help
    Replies: 21
    Last Post: Aug 09, 2010, 10:58 AM
  4. [CLOSED] [1.0] CompositeField FieldLabel's property
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 23, 2010, 3:25 PM
  5. Replies: 2
    Last Post: Mar 18, 2010, 11:36 AM

Posting Permissions