如何在组合框C#windowsa应用程序中绑定特定数据 [英] How to particular datas binding in combobox C# windowsa applicaiton
本文介绍了如何在组合框C#windowsa应用程序中绑定特定数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 c#.net 2010 创建Windows应用程序,这里我是使用网格视图,在我的网格视图中我是 set 组合框在页面加载选项中,我运行应用程序绑定所有数据库数据在组合框中显示,但我只想要特定数据的绑定 组合框如何创建。
Ex:
产品价格
40 1000 (这里组合框)绑定(仅限 40 个数值) 1000 , 900 如何绑定)
50 1500 (组合框)
40 900 (组合框)
给我任何一个想法
我的尝试:
如何绑定特定数据combobox c#windowsa applicaiton
解决方案
假设您使用的是ASP.NET,这篇文章会有所帮助
如何在ASP.Net中的GridView中填充DropDownList [ ^ ]
MSDN有解决:在GridView Web服务器控件中编辑时显示下拉列表 [ ^ ]
例子
DropDownList ddlProducts = ???; // 如何创建下拉列表取决于您
ddlProducts.DataSource = GetData ( SELECT ProductNo,Price FROM Products);
ddlProducts.DataTextField = Price; // 这将显示在文本字段中
ddlProducts.DataValueField = ProductNo; // 这可以用于其他查询
ddlProducts.DataBind();
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
解决方案
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
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();
这篇关于如何在组合框C#windowsa应用程序中绑定特定数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文