在代码隐藏中添加 Ext.Net.Gridpanel
本文关键字:Ext Net Gridpanel 添加 代码 隐藏 | 更新日期: 2023-09-27 18:34:31
我正在尝试使用数据库中的搜索结果构建多个网格面板。
但他们从未出现过...
这是我的代码,有什么问题?
http://pastebin.com/WuTZwZrP
编辑
好的,知道了。对于那些有相同问题的人,我通过将其添加到 GridPanel 来解决它:
RenderTo = this.ExtPanel.ClientID
构建后:
ext.GridPanel grid = this.BuildGridPanel(forwarder.Key, forwarder.Value);
grid.Render();
//this.ExtPanel.Controls.Add(grid);
public void AddGridPanel()
{
Ext.Net.GridPanel g=new Ext.Net.GridPanel();
Ext.Net.Store store1=new Ext.Net.Store();
Model model = new Model();
for (int i = 1; i < tas.getTaskDE().Count / 2; i++)
{
fields = fields + "," + tas.getTaskDE()[i].FieldName;
ModelField modelField = new ModelField();
modelField.Name = tas.getTaskDE()[i].FieldName;
model.Fields.Add(modelField);
if (tas.getTaskDE()[i].Visibility == "true")
{
g.ColumnModel.Columns.Add(new ColumnBase[] {
new Column
{
Text = tas.getTaskDE()[i].FieldADName,
DataIndex = tas.getTaskDE()[i].FieldName,
Flex = 1
},
});
}
}
SqlDataSource s = new SqlDataSource();
s.ConnectionString =ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
s.SelectCommand = query;
store1.Model.Add(model);
store1.DataSource = s;
store1.DataBind();
g.Store.Add(store1);
g.Render(this.Form);
}
这是动态网格面板的一个例子,希望它有所帮助