protected override void onl oad(EventArgs e)
{
base.OnLoad(e);
Control.Click += Control_Click;
container.DataChanged += container_DataChanged;
Control0.Click += Control0_Click;
string sql1 = @"select mfgordername from mfgorder";
DataTable dt1 = CamstarHelper.GetDatatable(sql1);
if (dt1 != null && dt1.Rows.Count > 0)
{
RecordSet rsNamedObject = new RecordSet();
// 创建一个Header数组
Header[] rsHeaders = new Header[1];
// 创建一个Row数组
Row[] rsRows = new Row[dt1.Rows.Count];
// 设置Header信息
rsHeaders[0] = new Header();
rsHeaders[0].TypeCode = TypeCode.String;
rsHeaders[0].Name = "Name";
// 设置RecordSet的Header
rsNamedObject.Headers = rsHeaders;
// 遍历DataTable的每一行,创建Row对象并设置值
for (int x = 0; x < dt1.Rows.Count; x++)
{
rsRows[x] = new Row();
rsRows[x].Values = new string[] { dt1.Rows[x]["mfgordername"].ToString() };
}
// 设置RecordSet的Rows
rsNamedObject.Rows = rsRows;
// 调用SetSelectionValues方法设置下拉列表的值
mfgorder.SetSelectionValues(rsNamedObject);
}
}
标签:Rows,代码,rsHeaders,Header,cs,new,dt1,下拉框,Row
From: https://www.cnblogs.com/yxle/p/18278570