Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9133099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:25:45+00:00 2026-06-17T08:25:45+00:00

How to create a simple two column combobox as shown at http://examples.ext.net/#/Form/ComboBox/Two_Columns/ from the

  • 0

How to create a simple two column combobox as shown at http://examples.ext.net/#/Form/ComboBox/Two_Columns/ from the code behind?

When creating exactly the same control by translating the markup to codebehind, few null reference errors occur on:

cbStates.ListConfig.....
cbStates.ListConfig.Tpl...

Code:

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Store1.DataSource = new object[]
        {
            new object[] { "AL", "Alabama", "The Heart of Dixie"},
            new object[] { "AK", "Alaska", "The Land of the Midnight Sun"},
            new object[] { "AZ", "Arizona", "The Grand Canyon State"},
            // 44 other states
            new object[] { "WV", "West Virginia", "Mountain State"},
            new object[] { "WI", "Wisconsin", "America's Dairyland"},
            new object[] { "WY", "Wyoming", "Like No Place on Earth"} 
        };

        this.Store1.DataBind();
        CreateCombo();
    }

    private void CreateCombo()
    {
        Ext.Net.ComboBox cbStates = new Ext.Net.ComboBox();
        cbStates.EmptyText = "Select State";
        cbStates.TypeAhead = true;
        cbStates.ForceSelection = true;
        cbStates.DisplayField = "state";
        cbStates.ValueField = "abbr";
        cbStates.MinChars = 1;
        cbStates.MatchFieldWidth = false;
        cbStates.PageSize = 10;
        cbStates.StoreID = "Store1";

        cbStates.ListConfig.Width = 320;
        cbStates.ListConfig.Height = 300;
        cbStates.ListConfig.ItemSelector = ".x-boundlist-item";
        cbStates.ListConfig.Tpl.Html = "<tpl for=\".\">"
                            + "<tpl if=\"[xindex] == 1\">"
                            + "<table class=\"cbStates-list\">"
                            + "<tr>"
                            + "<th>State</th>"
                            + "<th>Nick</th>"
                            + "</tr>"
                            + "</tpl>"
                            + "<tr class=\"x-boundlist-item\">"
                            + "<td>{state}</td>"
                            + "<td>{nick}</td>"
                            + "</tr>"
                            + "<tpl if=\"[xcount-xindex]==0\">"
                            + "</table>"
                            + "</tpl>"
                            + "</tpl>";

        Ext.Net.FieldTrigger trigger1 = new FieldTrigger();
        trigger1.Icon = TriggerIcon.Clear;
        trigger1.HideTrigger = true;

        cbStates.Triggers.Add(trigger1);

        cbStates.Listeners.BeforeQuery.Handler = "this.getTrigger(0)[this.getRawValue().toString().length == 0 ? 'hide' : 'show']();";
        cbStates.Listeners.TriggerClick.Handler = "if (index == 0) {this.focus().clearValue(); trigger.hide();}";
        cbStates.Listeners.Select.Handler = "this.getTrigger(0).show();";

        form1.Controls.Add(cbStates);
    }
</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></title>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager runat="server" />
    <ext:Store ID="Store1" runat="server" IsPagingStore="true" PageSize="10">
        <Model>
            <ext:Model ID="Model1" runat="server">
                <Fields>
                    <ext:ModelField Name="abbr" />
                    <ext:ModelField Name="state" />
                    <ext:ModelField Name="nick" />
                </Fields>
            </ext:Model>
        </Model>
    </ext:Store>
    </form>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:25:46+00:00Added an answer on June 17, 2026 at 8:25 am

    Do this way:

    Ext.Net.ComboBox cbStates = new Ext.Net.ComboBox();
    cbStates.EmptyText = "Select State";
    cbStates.TypeAhead = true;
    cbStates.ForceSelection = true;
    cbStates.DisplayField = "state";
    cbStates.ValueField = "abbr";
    cbStates.MinChars = 1;
    cbStates.MatchFieldWidth = false;
    cbStates.PageSize = 10;
    cbStates.StoreID = "Store1";
    
    BoundList listConfig = new BoundList();
    listConfig.Width = 320;
    listConfig.Height = 300;
    listConfig.ID = "lc";
    listConfig.ItemSelector = ".x-boundlist-item";
    XTemplate tpl = new XTemplate();
    
    tpl.Html = "<tpl for=\".\">"
                        + "<tpl if=\"[xindex] == 1\">"
                        + "<table class=\"cbStates-list\">"
                        + "<tr>"
                        + "<th>State</th>"
                        + "<th>Nick</th>"
                        + "</tr>"
                        + "</tpl>"
                        + "<tr class=\"x-boundlist-item\">"
                        + "<td>{state}</td>"
                        + "<td>{nick}</td>"
                        + "</tr>"
                        + "<tpl if=\"[xcount-xindex]==0\">"
                        + "</table>"
                        + "</tpl>"
                        + "</tpl>"; lc.Tpl = tpl;
    
    cbStates.ListConfig = lc;
    
    
    Ext.Net.FieldTrigger trigger1 = new FieldTrigger();
    trigger1.Icon = TriggerIcon.Clear;
    trigger1.HideTrigger = true;
    
    cbStates.Triggers.Add(trigger1);
    
    cbStates.Listeners.BeforeQuery.Handler = "this.getTrigger(0)[this.getRawValue().toString().length == 0 ? 'hide' : 'show']();";
    cbStates.Listeners.TriggerClick.Handler = "if (index == 0) {this.focus().clearValue(); trigger.hide();}";
    cbStates.Listeners.Select.Handler = "this.getTrigger(0).show();";
    
    form1.Controls.Add(cbStates);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a simple form with two different submit buttons: one which
I have a very simple table with two columns, but has 4.5M rows. CREATE
I'm trying to create a simple two labeled list by creating two label label
I've been given the task to create a simple Silverlight chat box for two
I'm trying to create a simple, custom, gallery. I have two lists, one with
I'd like to create a simple site on NodeJS. For example, it has two
I'm trying to create a pretty simple scatter plot with two data series. I
I have the following code which creates a simple window with two buttons which
I've a simple MySQL table named 'test' with two columns: Auto incrementing int column
I'm using a Google form to collect simple (City, State) data from a group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.