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.
Unfortunately, activation email could not send to your email. Please try again.

Undefined Value in cascading dropdownlist

Thread ID:

Created:

Updated:

Platform:

Replies:

128831 Feb 11,2017 01:02 PM Feb 13,2017 07:14 AM ASP.NET Web Forms 5
loading
Tags: DropDownList
Tomasz
Asked On February 11, 2017 01:02 PM

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.


Tomasz
Replied On February 11, 2017 01:04 PM

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.


Tomasz
Replied On February 11, 2017 02:58 PM

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

????


Karthikeyan Viswanathan [Syncfusion]
Replied On February 12, 2017 11:45 PM

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.  


Tomasz
Replied On February 13, 2017 04:16 AM

Hi 
Thanks for the answer and your help

Karthikeyan Viswanathan [Syncfusion]
Replied On February 13, 2017 07:14 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;