Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
good evening,

when i am binding dropdown to the database, one dropdownlist item repeats two times.

please help me.

thank you.
Posted
Comments
kishore Rajendran 27-Feb-13 6:37am    
please post your code
Member 9567873 27-Feb-13 6:55am    
this is my code

public void DropDownFill()
{
ItemManagementDetails itemDetails = new ItemManagementDetails();
ListItemForDropDown list = new ListItemForDropDown();
InventoryClient objService = new InventoryClient();

list = objService.FillDropDownStore();
list.List.RemoveAt(0);
ddlStoreId.DataSource = list.List.OrderBy(x => x.Text);
ddlStoreId.DataBind();
ddlStoreId.Items.Insert(0, "--Select --");

}
Member 9567873 27-Feb-13 6:59am    
I have posted the code please see the code and please help me
Matej Hlatky 27-Feb-13 7:03am    
Have you tried to use DISTINCT statement / Distinct() Linq extension method?
Member 9567873 27-Feb-13 7:08am    
no i have not used please tell me how to use it

Check what your query returns, maybe its in there 2 times
 
Share this answer
 
there is some issue in your code check it painfully, otherwise following code you can use.
C#
this.drpDown.Clear();
this.drpDown.DataSource = dt;
this.drpDown.DataBinding();
 
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