[CLOSED] Server tag is not correctly formatted

  1. #1

    [CLOSED] Server tag is not correctly formatted

    Server tag is not correctly formatted:
     <ext:Label ID="Label" Text="<%# GetText("Hello World") %>" runat="server"></ext:Label>
    
    public string GetText(string value)
    {
          return value;
    }
    Using the quotes does not give syntax error but does not work:

     <ext:Label ID="Label" Text='<%# GetText("Hello World") %>' runat="server"></ext:Label>
    
    public string GetText(string value)
    {
          return value;
    }
    Last edited by Daniil; Nov 01, 2010 at 7:30 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I guess you don't call Label's .DataBind() method. It's required.

    Please look at the example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        public string GetText(string value)
        {
            return value;
        }
    
        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.DataBind();    
        }
    </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 runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Label ID="Label1" Text='<%# GetText("Hello World") %>' runat="server" />
        </form>
    </body>
    </html>

Similar Threads

  1. Cant use Inline Server Tags in server markup
    By tuananhdnx in forum 1.x Help
    Replies: 1
    Last Post: Dec 04, 2011, 11:20 PM
  2. Replies: 2
    Last Post: Oct 05, 2010, 10:29 AM
  3. Replies: 1
    Last Post: Aug 11, 2010, 7:41 PM
  4. Replies: 3
    Last Post: May 11, 2010, 4:47 AM
  5. [CLOSED] Page not displayed correctly
    By speedstepmem2 in forum 1.x Premium Help
    Replies: 1
    Last Post: May 16, 2009, 6:00 AM

Posting Permissions