Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
C#
I am creating windows application using c#.net 2010, here I am using grid view, inside my grid view I am set combo box in page load option, I am run the application binding all database data’s are shown in combo box, but I want only particular data’s only binding for combobox how to create.
Ex: 
Product nu	prices
40		1000(combobox here binding (40 number values only) 1000, 900 how to bind )
50		1500(combobox)
40		900(combobox)

Give me any one idea


What I have tried:

How to particular datas binding in combobox c# windowsa applicaiton
Posted
Updated 31-May-16 4:08am
Comments
Beginner Luck 31-May-16 4:20am    
data bind using database or SQL server??
Boopalslm 31-May-16 4:51am    
sql server
Richard MacCutchan 31-May-16 6:43am    
Select only the required records from the database into your data adapter.

1 solution

Assuming you are using ASP.NET this article would be helpful
How to populate DropDownList in GridView in ASP.Net[^]

MSDN has a Walkthrough: Displaying a Drop-Down List While Editing in the GridView Web Server Control[^]

Example
C#
DropDownList ddlProducts = ???;  // How you create the drop down list is up to you
ddlProducts.DataSource = GetData("SELECT ProductNo, Price FROM Products");
ddlProducts.DataTextField = "Price";       // This will be shown in the text field
ddlProducts.DataValueField = "ProductNo";  // This can be used for other queries
ddlProducts.DataBind();
 
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