Click here to Skip to main content
15,907,225 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
protected void ClassDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
            if (ClassDropDownList.SelectedValue.Selected)
            {                 
            string myXMLfile = Server.MapPath("~/OrgList.xml");
            DataSet NAME_DATASET = new DataSet();
            NAME_DATASET.ReadXml(myXMLfile);
            NameDropDownList.DataSource = NAME_DATASET;
            NameDropDownList.DataTextField = "NAME";
            NameDropDownList.DataValueField = "ID";
            NameDropDownList.DataBind();
            }
}


I already have a class dropdownlist .when an item is selected in the class dropdown list i want the name dropdownlist to be populated. why is not popuating . what else should be done can i get the c# code please.
Posted
Updated 20-Sep-11 8:19am
v3
Comments
Pradeep Shukla 20-Sep-11 14:29pm    
What object is ClassDropDownList? a CombobBox or ListBox.

1 solution

Is this variable with weird name ClassDropDownList (Wow! a variable name of some type is given a name started with "Class". You probably name applications "Application*.exe" and your projects "Project*.csproj", don't you? :-))… so, is this variable really of the type System.Web.UI.WebControls.DropDownList? If so, you either typed not the same code you really try run, or what you say about your observation is not true. This is because the property SelectedValue is of the type System.String, so it cannot have a member called Selected, so this code would not compile.

Before asking questions, keep in mind that it's good to say truth and nothing but truth.

—SA
 
Share this answer
 
v2
Comments
Abhinav S 20-Sep-11 14:44pm    
My 5.
Sergey Alexandrovich Kryukov 20-Sep-11 14:54pm    
Thank you, Abhinav.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900