Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public void drop_department()
        {
            dt = bl.bl_drop_department();
            ddl_department.DataSource = dt;
            ddl_department.DataTextField ="CHILD_DESC";
            ddl_department.DataValueField ="CHILD_ID";
            ddl_department.DataBind();
            ddl_department.Items.Insert(0, "Select");


    }



Could you please help me, how to arrange the dropdown in alphabetical order , using the code above I am binding the dropdown from the database.
Posted
Comments
BillWoodruff 4-Oct-13 8:58am    
Is this Windows Forms ? Are you using a ComboBox ... or ?

1 solution

Sort the DataTable before binding.
C#
dt.DefaultView.Sort = "CHILD_DESC ASC"; 
 
Share this answer
 

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