如何绑定组合框值 [英] How to bind combobox values

查看:70
本文介绍了如何绑定组合框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将三个文本框值绑定到一个组合框中?我有3个文本框插入到DB中。如何每次将这三个值绑定到cimbobox.pls帮助我

How to bind three textboxes values into one combobox ?i''ve 3 textboxces am inserting into DB.How to bind these three values into cimbobox every time.pls help me

推荐答案

按照这个链接希望这将给出解决方案:



http://stackoverflow.com/questions/15794782/binding-checkbox-selected-value-textbox-to-different-property- than-properties-bo [ ^ ]
follow this link hope this will gives to the solution:

http://stackoverflow.com/questions/15794782/binding-checkbox-selected-value-textbox-to-different-property-than-properties-bo[^]


哦,那很简单。只需选择三个预期列,然后组合成一个字符串并返回为一列。然后就像简单的下拉列表一样绑定返回列。





示例代码:



Oh then it''s easy.just select three expected column and then combine into one string and return as one column.then just bind the returning column as like as simple drop down list.


Sample Code:

List<ListItem> users = new List<ListItem>();
foreach (SubscriptionUser su in subscriptionDetails.UserList)
{
    users.Add(new ListItem(su.FirstName + " " + su.LastName, su.EmailAddress));
}
ddlPrimaryContact.DataTextField = "Text";
ddlPrimaryContact.DataValueField = "Value";
ddlPrimaryContact.DataSource = users;
ddlPrimaryContact.DataBind();


希望这可以帮助



datatable dt = new datatable();

dt = filldata(); //填写dt的任何方法



CMB.DataTextField =Text feild;

CMB.DataValueField =value feild;

CMB.datasourse = dt;

CMB.databind();
wish this can help

datatable dt = new datatable();
dt = filldata(); // any method to fill dt

CMB.DataTextField ="Text feild";
CMB.DataValueField = "value feild ";
CMB.datasourse= dt ;
CMB.databind();


这篇关于如何绑定组合框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆