[FIXED] [V0.7] Error when setting text in ToolbarTextItem

  1. #1

    [FIXED] [V0.7] Error when setting text in ToolbarTextItem




    Hi
    Im trying to set the text property of a ToolbarTextItem, but that generates in a runtime javascript error. Please help me whit this quick! I need this to work asap.
    Thanks!


    
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                txtTest.SetText("TEST");         
            } 
               
        </script>
    
    
     
    
    
    <!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>Travel Perfect</title>
    
    
        <script type="text/javascript">                
    
    
        </script>
    
    
    </head>
    <body>
        <form id="form2" runat="server">
         <ext:ScriptManager ID="ScriptManager1" runat="server">
        </ext:ScriptManager>
        
        
    
    
        
        
         
        <ext:Panel runat="server" ID="Panel" Border="true" Title="test" BodyStyle="padding:4px;" AutoWidth="true" >
                      <Body>
                    <ext:StatusBar 
                        ID="sbBottombar" 
                        runat="server"  
                        DefaultText="">
                        <Items>
                        
                            <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server" />
                            <ext:ToolbarTextItem runat="server" ID="txtTest"></ext:ToolbarTextItem>
                            <ext:ToolbarSeparator ID="ToolbarSeparator6" runat="server" />                        
    
    
                            
                        </Items>
                    </ext:StatusBar>
                    </Body>        
        </ext:Panel>
                 
               
            
        
    
    
        </form>
    </body>
    </html>
  2. #2

    RE: [FIXED] [V0.7] Error when setting text in ToolbarTextItem

    Hi Mikael,

    The SetText is incorrectly implemented. We will fix this.
    Please note that SetText must be called only during AjaxEvent. During initial Page_Load you can use Text property.
    I wrote small example which shows how to change Text of ToolbarTextItem.

    <%@ Page Language="C#" %>
    <%@ 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">
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Ext.IsAjaxRequest)
            {
                TextItem1.Text = "Some text";
            }
        }
        
        protected void ChangeText_Click(object sender, AjaxEventArgs e)
        {
              // 0 - is index of ToolbarTextItem in Toolbar's Item collection
              this.ScriptManager2.AddScript("{0}.items.get(0).setText('Changed Text')", Toolbar1.ClientID);
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Example</title>
    </head>
    <body style="padding:10px;">
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager2" runat="server" StateProvider="PostBack" />
     
    
            <ext:Panel ID="Panel1" runat="server" Title="Panel with toolbar" Width="600" Height="300">
                <TopBar>
                    <ext:Toolbar ID="Toolbar1" runat="server">
                        <Items>                      
                            <ext:ToolbarTextItem ID="TextItem1" runat="server"></ext:ToolbarTextItem>
                            
                            <ext:ToolbarSeparator/>
                            
                            <ext:ToolbarButton runat="server" Text="Change Text">
                                <AjaxEvents>
                                    <Click OnEvent="ChangeText_Click"></Click>
                                </AjaxEvents>
                            </ext:ToolbarButton>
                        </Items>
                    </ext:Toolbar>
                </TopBar>           
            </ext:Panel>
        </form>
    </body>
    </html>

  3. #3

    RE: [FIXED] [V0.7] Error when setting text in ToolbarTextItem

    Ok, will you notify me when its fixed?

    Will my way of setting the textfield result in errors? Because I need to set the value on every page load, ajax request or not. So I thought that was the simplest way to do it.

    /Best regards
    Mikael
  4. #4

    RE: [FIXED] [V0.7] Error when setting text in ToolbarTextItem

    Hi Mikael,

    The fix has been committed to the SVN
    Please update and retest


  5. #5

    RE: [FIXED] [V0.7] Error when setting text in ToolbarTextItem

    Thanks you! works great now.

Similar Threads

  1. Replies: 3
    Last Post: Oct 02, 2009, 6:04 AM
  2. Replies: 5
    Last Post: Jan 27, 2009, 10:19 AM
  3. Replies: 1
    Last Post: Dec 30, 2008, 5:25 AM
  4. Replies: 4
    Last Post: Sep 10, 2008, 4:17 AM
  5. Replies: 2
    Last Post: Feb 20, 2008, 6:05 AM

Posting Permissions