related RadcomboBoxes gets reset after changingselectedIndexes

2 posts, 0 answers
  1. shemein
    shemein avatar
    28 posts
    Member since:
    Mar 2014

    Posted 15 Jul 2014 Link to this post

    I have two Radcombobox which the first one is binding to a dataTable. when the Item is selected from the first radcombobox according to that the second one Items maybe populated or if not we have to be able to type in it. when I click in the second one to type (for example:5555) the drop down collapses and 5555 is removed and it shows the default text so fast and the user oblige to open it again. I want the Radcombobox doesn't get refresh.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 Jul 2014 in reply to shemein Link to this post

    Hi shemein,

    Please try the below sample code snippet which works fine at my end. Please provide your code if it doesn't help.

    ASPX:
    <telerik:RadComboBox ID="rcboFirstList" runat="server" DataSourceID="sqldsOrders" EmptyMessage="select" DataTextField="Id" DataValueField="text" AutoPostBack="true" OnSelectedIndexChanged="rcboFirstList_SelectedIndexChanged">
    </telerik:RadComboBox>
    <telerik:RadComboBox ID="rcboSecondList" runat="server" AutoPostBack="true" AllowCustomText="true" EmptyMessage="Select">
    </telerik:RadComboBox>

    C#:
    protected void rcboFirstList_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM ComboSecond WHERE ID=@ID", connection);
        adapter.SelectCommand.Parameters.AddWithValue("@ID", e.Text);
        DataTable dt = new DataTable();
        adapter.Fill(dt);
        if (dt.Rows.Count != 0)
        {
            rcboSecondList.DataTextField = "ID";
            rcboSecondList.DataSource = dt;
            rcboSecondList.DataBind();
        }
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top