[CLOSED] FieldContainer

  1. #1

    [CLOSED] FieldContainer

    v3.2.1

    Having issues with FieldContainer. I cannot get a ComboBox to load in the container but a standard instantiated TextBox will load. Please explain how to make the combo box load. I also want to use Pack Start but i guess i need to load it first :)

    specifically need to load the data via code behind.

    Thanks,
    /Z

    markup
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StaticTest2.aspx.cs" Inherits="Crystal.Views.Support.StaticTest2" %>  
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html  lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Test</title>
    </head>
    <body>
    
    
        <form id="gg" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server"/>
    
    
            <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
                <Items>
                    <ext:FormPanel ID="FormPanelTest" runat="server" Title="test" BodyPadding="5" Width="800" MonitorResize="true" Layout="FormLayout" />
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>
    code behind
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    
    using Crystal.Models;
    using Crystal.Database;
    using Crystal.MVC;
    using Crystal.Domain.Base;
    
    
    using Ext.Net;
    
    
    
    
    namespace Crystal.Views.Support
    {
        public partial class StaticTest2 : BaseViewPage
        {
            protected override void OnPreRender(EventArgs e)
            {
                string pageName = "test";
                Ext.Net.FieldContainer hBoxEmployee = new Ext.Net.FieldContainer();
                hBoxEmployee.Layout = "HBoxLayout";
                hBoxEmployee.FieldLabel = "tt";
                hBoxEmployee.AnchorHorizontal = "100%";
    
    
                Ext.Net.FormPanel FormPanelTest = (Ext.Net.FormPanel)this.Page.FindControl("FormPanelTest");
    
    
                Ext.Net.ComboBox searchTypeCombo = buildComboBox("", "View" + pageName + "Combo_SearchType", true, 110, true, "", "", DataLoadMode.Default, false, "Search Type", "");
                searchTypeCombo.Items.Add(new ListItem("t1", "t1"));
                searchTypeCombo.Items.Add(new ListItem("t2", "t2"));
                searchTypeCombo.Items.Add(new ListItem("t3", "t3"));
                searchTypeCombo.Items.Add(new ListItem("t4", "t4"));
    
    
                TextField x = new TextField();
                x.Width = 140;
    
    
                hBoxEmployee.Add(searchTypeCombo);
                hBoxEmployee.Add(x);
    
    
                FormPanelTest.Add(hBoxEmployee);
    
    
                base.OnPreRender(e);
            }
    
    
            public static Ext.Net.ComboBox buildComboBox(string fieldLabel, string itemId, bool hideLabel, int width, bool enabled, string storeId, string valueField, Ext.Net.DataLoadMode mode, bool editable, string emptyText, string displayField)
            {
                Ext.Net.ComboBox.Config config = new Ext.Net.ComboBox.Config();
                config.ItemID = itemId;
                config.Hidden = hideLabel;
                if (!hideLabel)
                {
                    config.FieldLabel = fieldLabel;
                }
                config.Width = width;
                config.Disabled = !enabled;
                if (storeId != null && storeId.Length > 0)
                {
                    config.StoreID = storeId;
                }
                if (valueField != null && valueField.Length > 0)
                {
                    config.ValueField = valueField;
                }
                config.QueryMode = mode;
                config.Editable = editable;
                config.EmptyText = emptyText;
                if (displayField != null && displayField.Length > 0)
                {
                    config.DisplayField = displayField;
                }
    
    
                Ext.Net.ComboBox comboBox = new Ext.Net.ComboBox(config);
                comboBox.ID = itemId;
                return comboBox;
            }
        }
    }
    Last edited by Daniil; Sep 21, 2015 at 3:26 PM. Reason: [CLOSED]
  2. #2
    Hi @Z,

    This looks to be a mistake:
    config.Hidden = hideLabel;
  3. #3
    yep. that is a search/replace error.

    I replaced HideLabel with Hidden in one of my base classes. a really nasty copy/paste bug.

    Thanks for pointing it out as i stared at it for a while.

    /Z

Similar Threads

  1. [CLOSED] Bug in fieldcontainer when using label align top
    By Akpenob in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 24, 2014, 2:24 PM
  2. [CLOSED] FieldContainer hideLabel
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 06, 2014, 12:06 PM
  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. Replies: 5
    Last Post: Apr 10, 2012, 2:38 PM

Posting Permissions