Implement Cascading RadComboBox using C# in ASP.Net

on Oct 18, 2021 10:50 PM

I am trying to bind 2 combobox, being the value of the second dependent from the first.

All the solutions that i saw to this problem were by the use of Sql.Data (Datatable), which i can't use due to the architecture of the application.

I can do it 2 ways, by c# or through ASP.Net ObjectDataSource.

I've trying this approach with any sucess. It is possible to do this?

if (!Page.IsPostBack)
    recursohumano rh = new RecursoHumano();
    rdpUnidade.DataValueField= "ID"
    rdpUnidade.DataTextField= "NomeUnidade"
    rdpUnidade.DataSource= new BLLUnidade().GetAll();

    rdpInvestigador.DataValueField= "ID"
    rdpInvestigador.DataTextField= "Nome"
    rdpInvestigador.DataSource= new BLLRecursoHumano().GetAll();
    rdpInvestigador.Items.Insert(0, new RadComboBoxItem("", ""));

    //rdp investigador should depend on rdpUnidade

private void rdpUnidade_SelectedIndexChanged(object sender, EventArgs e)
    recursohumano rh = new RecursoHumano();
    var InvUnidade = from recursohumano in rh.recursohumano where == Convert.ToInt32(rdpUnidade.SelectedValue) select recursohumano;
    rdpInvestigador.DataValueField= "ID";
    rdpInvestigador.DataTextField= "Nome";
    rdpInvestigador.DataSource = new BLLRecursoHumano().GetAll()


Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Oct 19, 2021 04:08 AM


The problem is solved!

var res = RecHumano.GetAll().Where(x => x.IDUnidade == id).ToList()