[CLOSED] Update label Icon over AjaxMethod

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Update label Icon over AjaxMethod


    When I'm updating a label via an AjaxMethod, the text and so on get's updated fine, but when I do:

    this.labelOrderType.Icon = Icon.Lorry;
    The icon gets blank. It provides the space for the Icon, but it doesn't show it.

    Any idea,

    Kind regards,

  2. #2

    RE: [CLOSED] Update label Icon over AjaxMethod

    By the way, is it not possible to update a fieldlabel of a datefield via AjaxMethod?

    I have this:

    <ext:DateField ID="OrderDeliveryDateField" runat="server" ShowToday="true"></ext:DateField>
    In the aspx.cs file I have this:

    this.OrderDeliveryDateField.FieldLabel = "Deliverydate";
    But nothing appears...
  3. #3

    RE: [CLOSED] Update label Icon over AjaxMethod


    I've created an intermediate solution:

    I've added a second label and gave the first label my first icon and the second label the second icon. The second label is set to hidden and NOT used.

    Now it works:

    <ext:Label ID="labelOrderType" runat="server" Icon="Lorry" />
    <ext:Label ID="label1" runat="server" Icon="Basket" Hidden="true" />
    In the aspx.cs file I switch the icon of labelOrderType between Lorry and Basket.

    I think you only load those icons which are used from the start.

    Thanks, now yet an answer for the update of the fieldlabel of a datefield.


  4. #4

    RE: [CLOSED] Update label Icon over AjaxMethod

    ...now yet an answer for the update of the fieldlabel of a datefield.
    Hi Reno,

    I've added the ability to update the FieldLabel property during an AjaxEvent/AjaxMethod request.

    The following code sample demonstrates a full scenario.


    <%@ Page Language="C#" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    <script runat="server">
        protected void Button1_Click(object sender, AjaxEventArgs e)
            string text = this.TextField1.Text;
            if (!string.IsNullOrEmpty(text))
                this.TextField1.FieldLabel = text;
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
        <form id="form1" runat="server">
            <ext:ScriptManager runat="server" />
                    <ext:FormLayout runat="server" LabelAlign="Top">
                            <ext:Anchor Horizontal="100%">
                                    FieldLabel="Original FieldLabel" 
                                    EmptyText="New Label Text Here..."
                    <ext:Button runat="server" Text="Update">
                            <Click OnEvent="Button1_Click" />
    Please SVN update and re-test.

    Hope this helps.

    Geoffrey McGill
    Founder & CEO
  5. #5

    RE: [CLOSED] Update label Icon over AjaxMethod


    It still doesn't work, it gives me the following error (now I get an error, before the SVN update I didn't):
    Microsoft JScript compilation error: Expected ';'
    on line:
    var task=new Ext.util.DelayedTask(function(o,result,response){if(result.script&amp;&amp;result.script.length>0){eval(result.script);}
    result.script contains this:
    Coolite.Ext.setValues([[OrderFirstName,"Sven"],[OrderLastName,"De Leeuw"],[OrderCompanyName,""],[OrderVAT,""],
    [OrderStreet,"Nieuwe Kaai"],[OrderStreetNumber,"32A "],[OrderZipCode,"1760"],[OrderCity,"Roosdaal"],
    [OrderDeliveryLastName,"De Leeuw"],[OrderDeliveryStreet,"Nieuwe Kaai"],[OrderDeliveryStreetNumber,"32A 
    [OrderPaymentDate,"3/6/2009"],[OrderDeliveryDateField,new Date(2009,5,6,13,44,47)],[OrderPrice,"399"],[OrderTotal,"399"],
    [OrderMethod,"Delivery"],[OrderChargesOrDiscount,"+ 0"],[OrderID,"274"]]);labelOrderType.setText("<strong>Delivery</strong>",false);labelOrderType.setIconClass("icon-lorry");
    windowEdit.setTitle("Edit [274]");
    I have the following fields:
    <ext:Anchor Horizontal="95%">
    <ext:Anchor Horizontal="95%">
            FieldLabel="Pickup/Delivery Date"
    In my AjaxMethod I have:
    this.OrderChargesOrDiscount.FieldLabel = "Charges";
    this.OrderDeliveryDateField.FieldLabel = "Deliverydate";
    Now the strange part is that when I remove in my AjaxMethod the second line (the one that changes the datefield label), it works fine.

    Oh, I see the error.
    After the update function in your generated script you don't have a ; closure.
    Therefore it works when I only use one update of a fieldlabel, but crashes it on subsequent updates.

    Could you change this please?


  6. #6

    RE: [CLOSED] Update label Icon over AjaxMethod

    ok, Found it:

    In Component.cs in the Ext Folder:
                this.AddScript("{0}.el.parent().parent().child(\"label\").update(\"{1}\")", this.ClientID, text);
    should be:
                this.AddScript("{0}.el.parent().parent().child(\"label\").update(\"{1}\");", this.ClientID, text);

    Thanks for changing it in SVN

    Kind regards,


  7. #7

    RE: [CLOSED] Update label Icon over AjaxMethod

    It still doesn't work...

    Now I get:
    Microsoft JScript runtime error: 'OrderChargesOrDiscount.el' is null or not an object

    Is it maybe because this field is located on a tab which isn't visible yet at the moment of opening my form?

    If I continue I receive the next error:
    Microsoft JScript runtime error: 'OrderDeliveryDateField.el.parent().parent().child (...)' is null or not an object

    And that field IS shown directly on my form (not in a tab that is).

    So in any case it doesn't really work:
    Quick question: Did you test it before putting it into SVN? ;-)

    Kind regards,

  8. #8

    RE: [CLOSED] Update label Icon over AjaxMethod

    Hi Reno,

    I've committed a couple revisions to the SetFieldLabel Method.

    As well, set DeferredRender="false" on your TabPanel.

    Geoffrey McGill
    Founder & CEO
  9. #9

    RE: [CLOSED] Update label Icon over AjaxMethod

    Hello Geoffrey,

    It works now for the first field (textfield), but still not for the datefield...

    What else could be wrong?

    Maybe el.parent().parent().child("label") is different in case of Datefield, just a guess

    Kind regards,

  10. #10

    RE: [CLOSED] Update label Icon over AjaxMethod

    Yep, checked it out and in case of DateField you have to give it three times the parent.

    So in that case it should be something like : el.parent().parent().parent().child("label")
    I guess ;-)
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: Jan 08, 2010, 2:47 AM
  2. Update asp.net Repeater with AjaxMethod
    By FreddieBoo in forum 1.x Help
    Replies: 3
    Last Post: Aug 13, 2009, 7:21 AM
  3. How do I update an image url via an AjaxMethod?
    By dbassett74 in forum 1.x Help
    Replies: 1
    Last Post: Apr 28, 2009, 11:12 AM
  4. [CLOSED] GridPanel + Icon and/or Label Icon
    By state in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 28, 2009, 2:03 AM
  5. [ADDED] [V0.8.0] Label with icon
    By jchau in forum Feature Requests
    Replies: 4
    Last Post: Feb 03, 2009, 7:16 PM

Posting Permissions