We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set selected item by value

Thread ID:





141084 Nov 22,2018 05:13 PM UTC Nov 26,2018 05:40 AM UTC ASP.NET Web Forms 3
Tags: ComboBox
Fabio Marcos Euzebio
Asked On November 22, 2018 05:13 PM UTC

Hi !

I´m using "WebSamplerBrowser"provided by you to learn some components features.
In COMBOBOX "Databiding-local" example, I´ve added a button to select an item by clicking on it as shown bellow:

<asp:Content ID="Content1" ContentPlaceHolderID="ControlsSection" runat="server">
    <div class="frame">
        <div class="control">
            <ej:ComboBox ID="selectState" runat="server" Width="100%" DataTextField="countryName" DataValueField="index" Placeholder="Select a state">
            <br />
            <ej:Button ID="Button1" runat="server" Type="Button" Text="Click me to select North Carolina" Size="Mini" OnClick="selectMyItem" />

 protected void Page_Load(object sender, EventArgs e)
            if (!Page.IsPostBack)
                this.selectState.DataSource = States.GetStates();

        protected void selectMyItem(object Sender, Syncfusion.JavaScript.Web.ButtonEventArgs e)
            this.selectState.Value = "s26";

The event is fired as expected but the item is not selected.

What´s wrong here ?

Thank´s !

Prince Oliver [Syncfusion]
Replied On November 23, 2018 04:35 PM UTC

Hi Fabio, 

Thank you for contacting Syncfusion support. 

We have checked the reported issue in our end. This issue occurs because dataSource is not maintained after postback. We suggest you to set DataSourceCachingMode="Session" for ComboBox to resolve this issue. Please refer to the below given code 
<ej:ComboBox ID="selectState" runat="server" Width="300px" DataTextField="countryName"  DataValueField="index" Placeholder="Select a state" DataSourceCachingMode="Session"> 

Please let us know if you require any further assistance on this. 


Fabio Marcos Euzebio
Replied On November 23, 2018 07:36 PM UTC

Works perfectly !


Prince Oliver [Syncfusion]
Replied On November 26, 2018 05:40 AM UTC

Hi Fabio, 

Most Welcome. We are glad to help you. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon