I have two dropdownlist, one with letter of buildings and second with number of rooms
I create two data tables like in example :
//Display letter of buildings
public DataTable MyBuilding()
{
string connection = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string cmd = "select Building from Apartaments group by Building";
SqlDataAdapter sda = new SqlDataAdapter(cmd, connection);
DataTable dt = new DataTable();
sda.Fill(dt);
return dt;
}
//Display room s in building
public DataTable MyRoom(string build)
{
string connection2 = ConfigurationManager.ConnectionStrings["Intra2016ConnectionString"].ConnectionString;
string cmd2 = "select NoRoom, ApartId from Apartaments where Building = @Buildi";
SqlDataAdapter sda2 = new SqlDataAdapter(cmd2, connection2);
sda2.SelectCommand.Parameters.AddWithValue("Buildi", build);
DataTable dt = new DataTable();
sda2.Fill(dt);
return dt;
}
//And COde to execute
protected void ejddl1_ValueSelect(object sender, Syncfusion.JavaScript.Web.DropdownListEventArgs e)
{
ejddl2.DataSource = null;
ejddl2.Items.Clear();
string ejmb = e.SelectedText;
ejddl2.DataSource = MyRoom(ejmb);
}
With asp controls I don´t have any problem.
Run application and do first selection in building dropdownlist every is ok I see rooms corresponding to this building, but changing selection, in room ddl all value display like undefined. I’m testing different option – included sql direct result is every time the same.
Intra2016Entities db = new Intra2016Entities();
List<Apartaments> Apart = new List<Apartaments>();
Apart = db.Apartaments.Where(d => d.Building == e.Text).ToList(); // I testing with differents values - e.Value; e.SelectedText ..etc
ejddl2.DataSource = Apart;
and look value from selected events and that what I see everything is ok:
but result in room ddl is the same - undefined value
????