RadComboBox Change Not Firing

4 posts, 0 answers
  1. Mark
    Mark avatar
    127 posts
    Member since:
    May 2013

    Posted 13 Mar 2014 Link to this post

    Hi All,

    I've implemented a C# code-behind RadComboBox with a SqlDataSource and RadComboBoxFilter.Contains in order to provide search-box-like functionality to the users.  I run my code with the selected value using a RadButton. 

    The Users would like to be able to just hit enter or click on the desirable values to initiate the filter process.  The SelectedIndexChanged method does not appear to be firing.  I have AutoPostBack = true.  Being able to just type and enter would be the most desirable option.  Can anyone please help?

    Thanks,
    Mark

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Mar 2014 in reply to Mark Link to this post

    Hi Mark,

    Please have a look into the sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" DataSourceID="SqlDataSource1"
        AllowCustomText="true" Filter="Contains" AutoPostBack="true" DataTextField="Cityname"
        OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
    </telerik:RadComboBox>

    C#:
    protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        Response.Write("fired");
        //your code
    }

    Please provide your code if it doesn't help .
    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark
    Mark avatar
    127 posts
    Member since:
    May 2013

    Posted 14 Mar 2014 in reply to Shinu Link to this post

    Thanks Shinu!

    I'm actually doing everything in code behind, and for some odd reason SelectedIndexChanged is not firing.  I don't know why....

    Thanks,
    Mark

  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Mar 2014 in reply to Mark Link to this post

    Hi Mark,

    I tried to reproduce your issue but no avail. Please make sure that you are setting AutoPostBack property of RadComboBox to true as follows.

    C#:
    protected void Page_Init(object sender, EventArgs e)
    {
        RadComboBox combo = new RadComboBox();
        combo.ID = "RadComboBox1";
        combo.AutoPostBack = true;
        combo.Filter = RadComboBoxFilter.Contains;
        combo.AllowCustomText = true;
        combo.DataSourceID = "SqlDataSource1";
        combo.DataTextField = "Cityname";
        combo.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(combo_SelectedIndexChanged);
        form1.Controls.Add(combo);
        combo.DataBind();
    }
    void combo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
      //your code
    }

    Thanks,
    Shinu.
Back to Top