View Full Version : [CLOSED] How to pre select a value in ComboBox inside ComponentColumn

Oct 26, 2015, 9:11 PM
I am trying to pre-select a value in the cmbAdjustmentTypes combobox during Page_Load but it is not working. For example, Employee 1 is suppose to have AdjustmentType 1 pre selected but it is not.

Please see screenshot for reference.24301

Below is my code:

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="Newtonsoft.Json" %>
<%@ Import Namespace="System.Data" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
if (!X.IsAjaxRequest || !IsPostBack)
this.Store1.DataSource = new object[]
new object[] { "Employee 1", 1,3 },
new object[] { "Employee 2", 2,3 },
new object[] { "Employee 3", 2,3 },
new object[] { "Employee 4", 2,3},
new object[] { "Employee 5", 2,3 },
new object[] { "Employee 6",8,3},
new object[] { "Employee 7", 8,3 },
new object[] { "Employee 8", 8,3},
new object[] { "Employee 9", 9,3}


stAdjustmentTypes.DataSource = GetAdjustmentTypes();


public List<AdjustmentType> GetAdjustmentTypes()
List<AdjustmentType> adj = new List<AdjustmentType>(3);

for (int j = 0; j < 10; j++)
adj.Add(new AdjustmentType("Adjustment Type " + j, j));

return adj;

public class AdjustmentType
public AdjustmentType(string name, int adjustmentTypeID)
AdjustmentName = name;
AdjustmentTypeID = adjustmentTypeID;

public string AdjustmentName { get; set; }
public int AdjustmentTypeID { get; set; }

<!DOCTYPE html>
<head id="Head1" runat="server">
<title>ComponentColumn Over Editor - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />

.x-over-editor-grid tr.x-grid-row
height: 22px;
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
ComponentColumn multi controls</h1>
<ext:GridPanel ID="GridPanel1" runat="server" Title="Setup Adjustments" Width="1200"
<ext:Store ID="Store1" runat="server">
<ext:Model ID="Model1" runat="server">
<ext:ModelField Name="EmployeeName" Type="String" />
<ext:ModelField Name="AdjustmentTypeID" Type="Int" />
<ext:ModelField Name="RouteID" Type="Int" />
<ColumnModel ID="ColumnModel1" runat="server">
<ext:Column ID="Column1" runat="server" DataIndex="EmployeeName" Text="Adjustment Type">
<ext:ComponentColumn ID="ComponentColumn2" runat="server" Editor="true" Text="Adjustment"
<ext:Container runat="server">
<ext:ComboBox ID="cmbAdjustmentTypes" runat="server" DataIndex="AdjustmentTypeID" ValueField="AdjustmentTypeID" DisplayField="AdjustmentName" EmptyText="Select Adjustment">
<ext:Store ID="stAdjustmentTypes" runat="server" IsPagingStore="false" AutoLoad="false">
<ext:Model ID="mdAjustmentType" runat="server">
<ext:ModelField Name="AjustmentTypeID" />
<ext:ModelField Name="AdjustmentName" />

<ext:ComboBox ID="ComboBox2" runat="server" DataIndex="RouteID" EmptyText="Select Route">
<ext:ListItem Text="Item 1" Value="1" Mode="Raw" />
<ext:ListItem Text="Item 2" Value="2" Mode="Raw" />
<ext:ListItem Text="Item 3" Value="3" Mode="Raw" />
<ext:ListItem Text="Item 4" Value="4" Mode="Raw" />
<ext:ListItem Text="Item 5" Value="5" Mode="Raw" />
<ext:ListItem Text="Item 6" Value="6" Mode="Raw" />
<ext:ListItem Text="Item 7" Value="7" Mode="Raw" />
<ext:ListItem Text="Item 8" Value="8" Mode="Raw" />
<ext:ListItem Text="Item 9" Value="9" Mode="Raw" />


Oct 27, 2015, 1:58 PM
Hi @Fahd,

A ComponentColumn's Editor="true" is not going to work with a Container. It expects a field in a ComponentColumn's Component.

With your setup you have to manage applying of initial values manually. It could be done inside a ComponentColumn's BeforeBind listener.

An easier solution would be splitting the ComboBoxes into individual ComponentColumns.

Oct 27, 2015, 2:55 PM
Thanks for your reply. Can you please provide an example on how to do this in the ComponentColumn's BeforeBind listener?

Oct 27, 2015, 7:10 PM
Can you please provide an example on how to do this in the ComponentColumn's BeforeBind listener?

Can you give the tips Danill provided a try first? If your sample works, please share here with the community as it may help others in the future with a similar requirement.

If you cannot get your sample to work, please simplify that sample down to the minimum required to reproduce, and post an update.

Oct 28, 2015, 7:23 PM
I will find an alternative solution. Thanks anyway for your help. You may close this thread.