[CLOSED] TextField.FieldLabel is not changed in Code Behind

  1. #1

    [CLOSED] TextField.FieldLabel is not changed in Code Behind


    I need change the FieldLabel of my TextField in Code Behind, but when I set the property FieldLabel, the FieldLabel not changed...

    This works fine in 1.x version...

    Am I doing something wrong? changed the way to change this property? No reference found in the ChangeLog...

    I create a aspx to demostrate this problem...

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Teste3.aspx.vb" Inherits="SuperaWeb.Teste3" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        Protected Sub btn1_click(sender As Object, e As Ext.Net.DirectEventArgs)
            txtNome.FieldLabel = "Label 01"
            dsMessage.Text = "FieldLabel changed to 'Label 01'"
        End Sub
        Protected Sub btn2_click(sender As Object, e As Ext.Net.DirectEventArgs)
            txtNome.FieldLabel = "Label 02"
            dsMessage.Text = "FieldLabel changed to 'Label 02'"
        End Sub
    <!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">
        <form id="form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:TextField runat="server" ID="txtNome" FieldLabel="Label 01" Text="" />
            <ext:DisplayField runat="server" ID="dsMessage" Text="" Width="300px"/>
            <ext:Button runat="server" ID="btn1" Text="change FieldLabel to 'Label 01'">
                    <Click OnEvent="btn1_click"/>
            <ext:Button runat="server" ID="btn2" Text="change FieldLabel to 'Label 02'">
                    <Click OnEvent="btn2_click"/>
    Thanks for any help
    Last edited by Daniil; Jan 24, 2012 at 3:42 PM. Reason: [CLOSED]
  2. #2

    Confirmed. Thanks for the report.

    The fix has been added to SVN and will appear in DP2.

    For now, please use:
    TextField1.Call("setFieldLabel", "Label 02")
  3. #3
    Hi Daniil... thanks for your response...

    I try follow your suggestion, but errors occurs...
    In the messagebox, in attached image, is written:

    "runtime error in Microsoft JScript: the object does not support property or method 'setFieldLabel'

    Attachment 3759
  4. #4
    Confirmed. This method has appeared in the ExtJS 4.1.0, but DP1 is based on ExtJS 4.0.7.

    Please try to add the following thing into a page's <head>, should work.

    <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
    <script type="text/javascript">
            setFieldLabel: function(label){
                label = label || '';
                var me = this,
                    separator = me.labelSeparator,
                    labelEl = me.labelEl,
                me.fieldLabel = label;
                if (me.rendered) {
                    if (Ext.isEmpty(label) && me.hideEmptyLabel) {
                        me.labelEl = null;
                    } else {
                        labelEl = me.createLabelEl();
                        last = label.substr(label.length - 1);
                        if (last != separator) {
                            label += separator;
            createLabelEl: function(){
                var me = this;
                if (!me.labelEl) {
                    me.labelEl = me.el.insertFirst({
                        tag: 'label',
                        htmlFor: me.getInputId(),
                        cls: me.getLabelCls(),
                        style: me.getLabelStyle()
                return me.labelEl;
  5. #5
    Hi Daniil


    Thanks a lot

Similar Threads

  1. Replies: 2
    Last Post: Mar 11, 2012, 3:55 AM
  2. [CLOSED] TextField and FieldLabel
    By majunior in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 10, 2011, 2:30 PM
  3. [CLOSED] Textfield Fieldlabel
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Dec 02, 2009, 5:45 PM
  4. Checkbox changed handler in code-behind
    By drakaan in forum 1.x Help
    Replies: 6
    Last Post: Aug 24, 2009, 3:07 PM
  5. [CLOSED] Problems with FieldLabel in TextField.
    By flaviodamaia in forum 1.x Help
    Replies: 8
    Last Post: Sep 18, 2008, 2:41 PM

Posting Permissions