C# Combox组件动态下拉数据
客户有多个域名,要实现域名根据客户动态下拉选择,但是代码生成器生成的域名是TextBox组件,需要改成ComboBox组件。
改成ComboBox组件:
给ComboBox组件绑定QueryPopUp事件,点三角下拉按钮触发事件:
txtDomain_QueryPopUp
C# 全选
private string _LastCustomer = "";
private DataTable _LastCustomerTable = null;
private void txtDomain_QueryPopUp(object sender, CancelEventArgs e)
{
if (this.IsAddOrEditMode)
{
string customer = txtCustomerCode.EditValue.ToStringEx();
if (String.IsNullOrWhiteSpace(customer))
Assertion.AssertEditorEmpty(txtCustomerCode, "请选择客户!", true);
//当更换的客户,重新绑定ComboBox数据源
if (_LastCustomer != customer)
{
//获取客户的域名
_LastCustomerTable = _BLLInstance.GetDomains(customer);
_LastCustomer = customer;
//动态绑定域名
DataBinderTools.BoundComboBox(txtDomain, _LastCustomerTable, "Domain");
}
}
}
测试
快速开发框架
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网