[CLOSED]Setting text property of label

  1. #1

    [CLOSED]Setting text property of label



    Hi
    I have a label that Im trying to set the text property of, but the javascript will not even find the control. The label is on a parent page and the javascript . Anyone has an idea how to make this work?

    <script type="javascript">
    test()
    {
        parent.&#100;ocument.form1.lblInfo.value = "Value;
    }
    </script>
    
    <ext:Label ID="lblInfo" runat="server" AutoWidth="true" />

    Best regards
    Mikael Jürke
  2. #2

    RE: [CLOSED]Setting text property of label

    Hi,

    Can you post full code of example? May be your label in NamingContainer (master page or something else). In this case the ID and ClientID will be different. We use ClientID as ID for javascript controls

  3. #3

    RE: [CLOSED]Setting text property of label

    Hi
    Here is a simple example, but without the parent page. This is not working for me aswel.


    
    
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test_Default" %>
    
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    
    <!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 id="Head1" runat="server">
    
    
    <title></title>
    
    
    <link href="TravelPerfectSalesPort.css" rel="stylesheet" type="text/css" />
    
    
    <script type="text/javascript"> 
    
    
    
    
    
    function SetValue()
    
    
    {
    
    
    &#100;ocument.form1.lblInfo.value = "Value";
    
    
    }
    
    
    
    
    
    </script>
    
    
    
    
    
    
    
    
    </head>
    
    
    <body onload="SetValue();">
    
    
    <form id="form1" runat="server">
    
    
    <ext:ScriptManager ID="ScriptManager1" runat="server">
    
    
    </ext:ScriptManager>
    
    
    
    
    
    <ext:Label ID="lblInfo" runat="server">
    
    
    </ext:Label>
    
    
    </form>
    
    
    </body>
    
    
    </html>
    Best regards
    Mikael Jürke
  4. #4

    RE: [CLOSED]Setting text property of label

    Hi Mikael,

    1. Don't used any Coolite js objects on Body Load event because at this moment the Coolite init script has not started yet. You can use ScriptManager DocumentReady event for it.

    2. All Coolite controls accessable through window object
    3. The new value for label must be set with setText function

            function SetValue()
            {
                window.lblInfo.setText("Value");
            }

  5. #5

    RE: [CLOSED]Setting text property of label

    Okay, thanks! works great!

    Best regards
    Mikael Jürke

Similar Threads

  1. Replies: 2
    Last Post: Jul 25, 2012, 4:08 PM
  2. Replies: 4
    Last Post: Jul 29, 2011, 7:02 AM
  3. [CLOSED] Setting Label from Store Event
    By HOWARDJ in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 17, 2009, 3:07 PM
  4. GUID in Ext:Label.Text property...
    By shaun in forum 1.x Help
    Replies: 2
    Last Post: Jul 26, 2009, 8:14 PM
  5. [CLOSED] MultiSelect and text items with comma in Text property
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 15, 2009, 2:30 PM

Posting Permissions