DataBinderTools.BoundComboBox方法,绑定ComboBox组件的下拉数据源-C/S开发框架
作者:csframework|C/S框架网  发布日期:2021/12/30 18:35:45

用于绑定ComboBox组件的下拉数据源。

DataBinderTools.BoundComboBox方法,绑定ComboBox组件的下拉数据源-C/S开发框架

C# 全选
public static void BoundComboBox(ComboBoxEdit editor, DataTable dt, string fieldName)
{
    editor.Properties.Items.Clear();
    editor.Properties.DropDownItemHeight = 25;

    foreach (DataRow R in dt.Rows)
    {
        editor.Properties.Items.Add(R[fieldName]);
    }

    if (dt.Rows.Count > 0)
        editor.Properties.DropDownRows = 10;
    else
        editor.Properties.DropDownRows = dt.Rows.Count;
}

上一篇 下一篇