ext.net 开发学习之TabPanel (二)
昨天捣鼓好了页面框架,得到了园友的帮忙,在这里 说声 “谢谢”…… :)
框架好了,当然要实现效果。cs的效果如下,当然我们这边开发bs也要求这样。把需求的效果贴出:
大致可以看出 一个主页面 嵌套tab页,再在子页面中嵌套一个panel和tab页面
ext.net 完全可以搞定,昨天我们的首页框架主要是前台aspx生成的。为了以后的扩展性,我们今天把显示层用cs实现……效果如下:
代码也贴出,有需要改正或修改的 还麻烦前辈 赐教 感谢
public partial class extEmployeeInfos : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = CreatePageDao.GetStrucPanelSetTable("BF019");//根据数据源生成Tab 可根据不同需求生成
SetPanel(dt, "pnlName");//数据源列名(Tab标题)
}
/// <summary>
/// 设置主页面
/// </summary>
/// <param name="dtPanel">表</param>
/// <param name="strRowTitle">表dtPanel:列名</param>
public void SetPanel(DataTable dtPanel, string strRowTitle)
{
// Make TabPanel for Center Region
TabPanel center = SetTabPanel();
// Make Tab
Ext.Net.Panel panel;
if (dtPanel == null || dtPanel.Rows.Count <= 0)
return;
for (int i = 0; i < dtPanel.Rows.Count; i++)
{
panel = new Ext.Net.Panel();
panel.ID = "panel" + i;
panel.Title = dtPanel.Rows[i][strRowTitle].ToString();
panel.Border = false;
center.Items.Add(panel);
if (i == 0)
SetPanelItems(panel);
}
BorderLayout bl = new BorderLayout();
bl.Center.Items.Add(center);
Viewport vp = new Viewport();
vp.ContentControls.Add(bl);
phContent.Controls.Add(vp);
}
/// <summary>
/// 设置 第一个tabpanel : 内容控件 上下panel
/// </summary>
/// <param name="center">主panel</param>
private void SetPanelItems( Ext.Net.Panel center )
{
//////////////////
// NORTH REGION //
//////////////////
// Make Panel for South Region
Ext.Net.Panel north = new Ext.Net.Panel();
north.ID = "NorthPanel";
//north.Title = "North";
north.Height = Unit.Pixel(500);
north.BodyStyle = "padding:6px;";
//north.Html = "North";
north.Collapsible = true;
center.Items.Add(north);
//////////////////
// SOUTH REGION //
//////////////////
SetPanel_TablPanel(CreatePageDao.GetStrucPanelSetTable("BF019"), "pnlName", center);
}
/// <summary>
///设置Panel 子panel中添加tablPanel
/// </summary>
/// <param name="dtPanel">根据table值添加tablepanel </param>
/// <param name="strRowTitle">title</param>
/// <param name="panelContent"></param>
private void SetPanel_TablPanel(DataTable dtPanel, string strRowTitle, Ext.Net.Panel panelContent)
{
// Make TabPanel for Center Region
TabPanel center = new TabPanel();
center.ID = "tabCenterChild";
center.Title = "";
center.ActiveTabIndex = 0;
// Make Tab
Ext.Net.Panel panel;
for (int i = 0; i < dtPanel.Rows.Count; i++)
{
panel = new Ext.Net.Panel();
panel.ID = "panelChild" + i;
panel.Title = dtPanel.Rows[i][strRowTitle].ToString();
panel.Border = false;
center.Items.Add(panel);
}
panelContent.Items.Add(center);
}
#region 设置TabPanel
/// <summary>
/// 设置TabPanel
/// </summary>
/// <param name="strID">ID</param>
/// <param name="strTitle">标题</param>
/// <returns></returns>
public TabPanel SetTabPanel(string strID, string strTitle)
{
// Make TabPanel for Center Region
TabPanel center = new TabPanel();
center.ID = strID;
center.Title = strTitle;
center.ActiveTabIndex = 0;
return center;
}
public TabPanel SetTabPanel()
{
// Make TabPanel for Center Region
TabPanel center = new TabPanel();
center.ID = "tabCenter";
center.Title = "";
center.Border = false;
center.Split = false;
center.ActiveTabIndex = 0;
return center;
}
#endregion
}
作者:PEPE
出处:http://pepe.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
作者:PEPE
出处:http://pepe.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。