[CLOSED] how to add content of fieldcontainer in codebehind?

  1. #1

    [CLOSED] how to add content of fieldcontainer in codebehind?

    <ext:FieldContainer ID="Container1" AnchorHorizontal="100%" runat="server" FieldLabel="验证码">
                        <Content>
                            <obout:CaptchaImage ID="Captcha1" runat="server" RelativeImageUrl="false" />
                            <a href="javascript:$find('<%=Captcha1.ClientID %>').getNewImage();">看不清?</a>
                        </Content>
                    </ext:FieldContainer>
    how to do above in codebehind?

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm44.aspx.cs" Inherits="extdemo.test.WebForm44" %>
    
    <%@ Import Namespace="Ext.Net" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                CreateLoginWindow();
            }
            private void CreateLoginWindow()
            {
                var window = new Ext.Net.Window
                {
                    Title = "用户登录",
                    ID = "w_login",
                    Width = 300,
                    Modal = true,
                    Closable = false,
    
                };
                var fp = new Ext.Net.FormPanel
                {
                    Padding = 4,
                    Layout = LayoutType.Anchor.ToString(),
    
                    Buttons =
                    {
                        new Ext.Net.Button {Text = "取消"},
                        new Ext.Net.Button {Text = "登录"}
                    }
                };
                var tfName = new TextField
                {
                    ID = "tf_uname",
                    FieldLabel = "用户名",
                    AnchorHorizontal = "100%",
                    Margin = 4,
                    LabelWidth = 60
                };
                var tfPass = new TextField
                {
                    ID = "tf_pass",
                    FieldLabel = "密码",
                    AnchorHorizontal = "100%",
                    Margin = 4,
                    LabelWidth = 60
                };
                fp.Items.Add(tfName);
                fp.Items.Add(tfPass);
                var fc = new FieldContainer();
                //   fc.Content=
                fp.Items.Add(fc);
                window.Items.Add(fp);
                this.Form.Controls.Add(window);
            }
        
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager runat="server"></ext:ResourceManager>
        </form>
    </body>
    </html>
    Last edited by Daniil; May 20, 2014 at 7:58 AM. Reason: [CLOSED]
  2. #2
    Hi @hdsoso,

    Please put the controls into a FieldContainer's ContentControls.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @hdsoso,

    Please put the controls into a FieldContainer's ContentControls.
    what about a tag?
  4. #4
    You can use a GenericHtmlControl.
    http://stackoverflow.com/questions/1...-label-control

Similar Threads

  1. [CLOSED] FieldContainer hideLabel
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 06, 2014, 12:06 PM
  2. [CLOSED] how to show a hidden fieldcontainer?
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Mar 23, 2014, 12:50 AM
  3. Problem with FieldContainer anchoring
    By rammus in forum 2.x Help
    Replies: 6
    Last Post: Feb 25, 2013, 9:47 PM
  4. [CLOSED] V2.1 FieldContainer & FieldDefaults
    By Aurelio in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 14, 2012, 4:27 PM
  5. [CLOSED] Content in codebehind
    By heysol in forum 1.x Help
    Replies: 7
    Last Post: Nov 06, 2008, 9:16 PM

Posting Permissions