View Full Version : [CLOSED] TextField.FieldLabel is not changed in Code Behind

Jan 24, 2012, 12:00 PM

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

Jan 24, 2012, 1:51 PM

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")

Jan 24, 2012, 2:47 PM
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'


Jan 24, 2012, 3:16 PM
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;

Jan 24, 2012, 3:28 PM
Hi Daniil


Thanks a lot