View Full Version : [CLOSED] Setting Currently Selected Text as Text for Combobox

Mar 13, 2013, 5:40 AM

Ext.net V2.0
ASp.net with vb

I have gridpanel containing Combobox column in it, i m populating the gridpanel from codebehind. what i want to do is whenever user enters the combobox column, if the cell value is blank then first item in the combobox should get selected, or else if the combobox have some selected text in it the it should appear as text for the cell on focus and user should be able to change it afterwords.

in short the combobox cell in gridpanel should never be empty, either it should show first value in the combobox as cell text or selected text as cell text

for more clarity please refer attached image.


Mar 13, 2013, 5:54 AM
Hi @hemantpatil,

Hope this helps.


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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
if (!X.IsAjaxRequest)
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
new object[] { "2" },
new object[] { },
new object[] { "3" }

<!DOCTYPE html>

<head runat="server">
<title>Ext.NET v2 Example</title>

var on = function () {


.myСlass {
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server">
<ext:Store runat="server">
<ext:Model runat="server">
<ext:ModelField Name="test" />
<ColumnModel runat="server">
<ext:Column runat="server" Text="Test" DataIndex="test">
<ext:ComboBox ID="ComboBox1" runat="server">
<ext:ListItem Text="1" />
<ext:ListItem Text="2" />
<ext:ListItem Text="3" />
<ext:ListItem Index="0" />
<StartEdit Handler="if (Ext.isEmpty(value)) {

Delay="1" />
<ext:CellEditing runat="server" />

Mar 13, 2013, 7:00 AM
Hi Daniil,

Thanks for the Reply. it's just what i wanted. Thank you very much.

another thing i want to ask is, as per the example, if the cell value is blank/empty then we use 0 index record from store. this is ok in case of first row in grid where no value is selected in the combobox, but if i add a new row dynamically, then also the value for the column will be empty, but in this scenario i want to set the last selected value in the combobox, or value of previous cell in the same column, as cell text.

how can i do this.

Mar 13, 2013, 8:26 AM
I think it is possible to implement in the StartEdit handler.

Mar 13, 2013, 9:05 AM
Can you please tell me how to get selected value of Combobox in StartEdit handler.

Mar 13, 2013, 10:56 AM
Could you, please, provide a sample to test with?