Sep 20, 2015, 6:03 AM
[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
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 behindusing 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]