This is a migrated thread and some comments may be shown as answers.

ComboBox does not open after being loaded by another

1 Answer 31 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Fabiano
Top achievements
Rank 1
Fabiano asked on 05 Jan 2014, 03:32 PM
Hello
I have a problem to use the RadComboBox component.
I happen to have three combos where one feeds off the other according to the selected value.
When I select the first, the second is loaded.
When I select the second third is loaded.
But when I select the third combo does not open when I click on it.
For it to work, it is necessary that I give a click outside of it (anywhere on the form) and then click it again to open the content.
This happens in all forms that have a sequence of 3 or more combos.
Would know tell me why? Is there a solution for this?


The aspx code of three combos:
<td style="text-align: left">
      <telerik:RadComboBox ID="rddlTipoRegistro" runat="server" Width="120px" RegisterWithScriptManager="true"
           AppendDataBoundItems="True" AutoPostBack="True" Culture="pt-BR" MarkFirstMatch="True"
           OnSelectedIndexChanged="rddlTipoRegistro_SelectedIndexChanged">
      </telerik:RadComboBox>
</td>
<td style="text-align: left">
      <telerik:RadComboBox ID="ddlArea" runat="server" Width="220px" AppendDataBoundItems="True"
         AutoPostBack="True" OnSelectedIndexChanged="ddlArea_SelectedIndexChanged" Culture="pt-BR"
          MarkFirstMatch="True">
      </telerik:RadComboBox>
</td>
<td style="text-align: left">
      <telerik:RadComboBox ID="ddlCelulaServico" runat="server" Width="200px" AppendDataBoundItems="True"
        AutoPostBack="True" OnSelectedIndexChanged="ddlCelulaServico_SelectedIndexChanged"
        Culture="pt-BR" MarkFirstMatch="True">
    </telerik:RadComboBox>
 </td>


And the way they are loaded.
The combo rddlTipoRegistro bears ddlArea combo which in turn loads the combo ddlCelulaServico
and this does not open if you click right then.

TipoRegistroBO tipoRegistroBo = new TipoRegistroBO();
rddlTipoRegistro.Items.Clear();
rddlTipoRegistro.Items.Add(new RadComboBoxItem("Selecione", "0"));
rddlTipoRegistro.DataValueField = "Id";
rddlTipoRegistro.DataTextField = "Descricao";
rddlTipoRegistro.DataSource = tipoRegistroBo.getMany(new TipoRegistroVO());
rddlTipoRegistro.DataBind();
 
 
ServicoBO bo = new ServicoBO();
ServicoVO filtro = new ServicoVO();
filtro.TipoRegistro = new TipoRegistroVO(Convert.ToInt32(rddlTipoRegistro.SelectedValue));
ddlArea.DataValueField = "Id";
ddlArea.DataTextField = "Descricao";
ddlArea.DataSource = bo.getAreaPorTipoRegistro(filtro);
ddlArea.DataBind();
 
 
ServicoBO bo = new ServicoBO();
ServicoVO filtro = new ServicoVO();
filtro.TipoRegistro = new TipoRegistroVO(Convert.ToInt32(rddlTipoRegistro.SelectedValue));
filtro.Area = new AreaVO(Convert.ToInt32(ddlArea.SelectedValue));
ddlCelulaServico.DataValueField = "Id";
ddlCelulaServico.DataTextField = "Descricao";
ddlCelulaServico.DataSource = bo.getCelulaPorTipoRegistroArea(filtro);
ddlCelulaServico.DataBind();

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Jan 2014, 06:45 AM
Hi Fabiano,

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

ASPX:
<telerik:RadComboBox ID="rddlTipoRegistro" runat="server" Width="120px" RegisterWithScriptManager="true"
    AppendDataBoundItems="True" AutoPostBack="True" Culture="pt-BR" MarkFirstMatch="True"
    EmptyMessage="--Select--" OnSelectedIndexChanged="rddlTipoRegistro_SelectedIndexChanged">
</telerik:RadComboBox>

<telerik:RadComboBox ID="ddlArea" runat="server" Width="220px" AppendDataBoundItems="True"
    AutoPostBack="True" Culture="pt-BR" MarkFirstMatch="True" EmptyMessage="--select--"
    OnSelectedIndexChanged="ddlArea_SelectedIndexChanged">
</telerik:RadComboBox>

<telerik:RadComboBox ID="ddlCelulaServico" runat="server" Width="200px" AppendDataBoundItems="True"
    AutoPostBack="True" Culture="pt-BR" MarkFirstMatch="True" EmptyMessage="--select--"
    OnSelectedIndexChanged="ddlCelulaServico_SelectedIndexChanged">
</telerik:RadComboBox>

C#:
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Northwind_newConnectionString"].ConnectionString);
        SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Continents ORDER By Name", connection);
        DataTable dt = new DataTable();
        adapter.Fill(dt);
        rddlTipoRegistro.DataTextField = "Name";
        rddlTipoRegistro.DataValueField = "ID";
        rddlTipoRegistro.DataSource = dt;
        rddlTipoRegistro.DataBind();
    }
}
protected void rddlTipoRegistro_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
    ddlArea.ClearSelection();
    ddlArea.Items.Clear();
    ddlCelulaServico.ClearSelection();
    ddlCelulaServico.Items.Clear();
    SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Northwind_newConnectionString"].ConnectionString);
    SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Countries WHERE ContinentID=@ContinentID ORDER By Name", connection);
    adapter.SelectCommand.Parameters.AddWithValue("@ContinentID", e.Value);
    DataTable dt = new DataTable();
    adapter.Fill(dt);
    ddlArea.DataTextField = "Name";
    ddlArea.DataValueField = "ID";
    ddlArea.DataSource = dt;
    ddlArea.DataBind();
}
protected void ddlArea_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
    ddlCelulaServico.ClearSelection();
    ddlCelulaServico.Items.Clear();
    SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Northwind_newConnectionString"].ConnectionString);
    SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Cities WHERE CountryID=@CountryID ORDER By Name", connection);
    adapter.SelectCommand.Parameters.AddWithValue("@CountryID", e.Value);
    DataTable dt = new DataTable();
    adapter.Fill(dt);
    ddlCelulaServico.DataTextField = "Name";
    ddlCelulaServico.DataValueField = "ID";
    ddlCelulaServico.DataSource = dt;
    ddlCelulaServico.DataBind();
}
protected void ddlCelulaServico_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
    Response.Write(e.Text);
}

Hope this will helps you.
Thanks,
Shinu.

Tags
ComboBox
Asked by
Fabiano
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or