批属性动态加载
1.如果是查询页面,只需要在SQL中加上批数量查询语句,然后加上如下加载页面
protected override void OnInit(EventArgs e)
{
UIExtend.InitGridColumn(this.gvData, 12);
}
2.如果是编辑页面,则需要在datagrid中增加对应栏位
<asp:ETemplateField HeaderText="批号" DataField="LOT_NO" TwoWay="txtLOT_NO" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100" HeaderStyle-CssClass="yellow" Visible="false">
<ItemTemplate>
<asp:ETextBox runat="server" ID="txtLOT_NO" Width="85%" DataField="LOT_NO" Text='<%# Eval("LOT_NO") %>'></asp:ETextBox>
</ItemTemplate>
</asp:ETemplateField>
在后台控制显示的逻辑
private void GetConfigLotTable()
{
EciRequest request = new EciRequest(WMSService.ConfigLottableSearch);
EciResponse response = SOA.Execute(request);
var dt = request.Execute().DataTable;
List<string> list = new List<string>();
for (int i = 0; i < dt.Rows.Count; i++)
{
list.Add(dt.Rows[i]["LOTTABLE_NAME"].ToString());
}
Dictionary<int, string> listName = new Dictionary<int, string>();
for (int i = 0; i < gvData.Columns.Count; i++)
{
if (list.Contains(gvData.Columns[i].HeaderText))
{
gvData.Columns[i].Visible = true;
}
}
}
在page_load里面调用