How Update control Ext: Label from Javascript

  1. #1

    How Update control Ext: Label from Javascript

    As you may have noticed, recently I iciandome with ExtNet's cool.

    Well, I have some doubts about how to update a control Ext: label from javascri

    Code Page.aspx
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        </ext:ResourceManager>
        <form id="form1" runat="server">
        <ext:Label ID="lblTestEN" runat="server"></ext:Label>
            <br />
            <ext:Button ID="btnTest" runat="server" Text="Click me" >
                <Listeners>
                    <Click Fn="updateLabel" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    Function for update Label
    <script type="text/javascript" language="javascript">
            var updateLabel = function () {
                var msg = "Updated!!!"
                lblTestEN.update(msg);
            };
        </script>
    It also works as follows
    Ext.fly("lblTestEN").update(msg);
    I would like to know the difference between the two ways to perform the update of the value of the label and what is most optimal. There are other ways to update the value?

    Thanks for all...

    FAFNER
  2. #2
    Hi FAFNER,

    The two techniques you posted work perfectly and either one will get the job done.

    That said, there is a third option of using the .setText() function.

    I'd go with the .setText() function as it will provide more consistency within the framework and forward compatibility.

    Example

    lblTestEN.setText(msg);
    Hope this helps.
    Geoffrey McGill
    Founder
  3. #3
    Thanks, this solved my 2 problems.

    Thanks for everything.

    FAFNER

Similar Threads

  1. [CLOSED] Update Asp Net Label inside asp ListView in Directmethod
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 26, 2012, 2:54 PM
  2. Problems with Update in Ext:Label
    By FAFNER in forum 1.x Help
    Replies: 1
    Last Post: Apr 07, 2011, 4:29 AM
  3. [CLOSED] FormPanel - Hide control - label control
    By seanwo in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 11, 2010, 8:57 AM
  4. [CLOSED] Update label Icon over AjaxMethod
    By reinout.mechant@imprss.be in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Jun 07, 2009, 2:48 AM
  5. Replies: 0
    Last Post: Apr 24, 2009, 11:02 AM

Tags for this Thread

Posting Permissions