[CLOSED] Setting Currently Selected Text as Text for Combobox

  1. #1

    [CLOSED] Setting Currently Selected Text as Text for Combobox


    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.

    Click image for larger version. 

Name:	Conbobox_Select.png 
Views:	43 
Size:	24.8 KB 
ID:	5800
    Last edited by Daniil; Mar 19, 2013 at 4:28 AM. Reason: [CLOSED]
  2. #2
    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" />
  3. #3
    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.
  4. #4
    I think it is possible to implement in the StartEdit handler.
  5. #5
    Can you please tell me how to get selected value of Combobox in StartEdit handler.
  6. #6
    Could you, please, provide a sample to test with?

Similar Threads

  1. combobox: value selected instead of text
    By Birgit in forum 2.x Help
    Replies: 2
    Last Post: Nov 21, 2012, 8:42 AM
  2. Replies: 3
    Last Post: Oct 27, 2012, 10:47 AM
  3. [CLOSED] ComboBox Editor in Grid reverts selected to VALUE , not TEXT
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 10, 2011, 3:00 PM
  4. [CLOSED] ComboBox in GridPanel Displaying Selected Value instead of Text
    By iansriley in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 22, 2010, 7:17 PM
  5. Replies: 10
    Last Post: Apr 05, 2010, 1:42 AM

Posting Permissions