We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Undefined Value in cascading dropdownlist

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);
}

SeelctO

SelecOne


With asp controls I don´t have any problem.


5 Replies

TO Tomasz February 11, 2017 06:04 PM UTC

This is the text loosing when submit my post

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.



TO Tomasz February 11, 2017 07:58 PM UTC

I'm testing binding data to dropdownlist like below:

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:

agrsev

but result in room ddl is the same - undefined value

????



KV Karthikeyan Viswanathan Syncfusion Team February 13, 2017 04:45 AM UTC

Hi Tomasz, 
Thanks for contacting Syncfusion support.    
We have created branch incident related this query. Can you please follow up that incident.  
Please find the link:  
  Regards,  
Karthikeyan V.  



TO Tomasz February 13, 2017 09:16 AM UTC

Hi 
Thanks for the answer and your help


KV Karthikeyan Viswanathan Syncfusion Team February 13, 2017 12:14 PM UTC

Hi Tomasz,  
Thanks for the update.  
 
We are glad the suggestion helped you to achieve your requirement.  
 
Regards,   
Karthikeyan V.

Loader.
Live Chat Icon For mobile
Up arrow icon