FineUI 官方论坛
标题:
向父页面添加TAB
[打印本页]
作者:
kαИ啥ル?
时间:
2012-9-16 16:39
标题:
向父页面添加TAB
我的手风琴是通过数据库绑定的,求高手告诉我怎么向父页面添加TAB
以下是绑定手风琴的方法
/// <summary>
/// /// 绑定手风琴目录
/// /// </summary>
protected void BindMenu()
{
DataSet ds = Menu_Bill.Instance.GetDSMenuInfo(User_Models.User_id);
ExtAspNet.Accordion accordion = new ExtAspNet.Accordion();
Region2.Items.Add(accordion);
accordion.ShowBorder = false;
accordion.ShowHeader = false;
//找出所有手风琴节点
DataRow[] drParent = ds.Tables[0].Select("Menu_ParentId=''");
//遍历创建每个手风琴节点
foreach (DataRow dr in drParent)
{
ExtAspNet.AccordionPane pane = new ExtAspNet.AccordionPane();
accordion.Panes.Add(pane);
pane.Title = dr["Menu_Name"].ToString();
//HttpContext.Current.Server.MapPath("/") +
pane.IconUrl = dr["Menu_Ico"].ToString();
pane.ShowBorder = false;
//pane.Icon = dr["menu_ico"].ToString();
//创建该节点下的菜单目录,并将该手风琴节点的ID作为下属菜单的父节点
CreateTree(ds, dr["Menu_No"].ToString(), pane);
}
}
/// <summary>
/// 绑定树状目录
/// </summary>
protected void CreateTree(DataSet ds, string PrentID, ExtAspNet.AccordionPane pane)
{
DataRow[] drParent = ds.Tables[0].Select("Menu_ParentId='" + PrentID + "'");
ExtAspNet.Tree tree = new ExtAspNet.Tree();
pane.Items.Add(tree);
tree.ShowBorder = false;
tree.ShowHeader = false;
tree.AutoScroll = false;
tree.EnableArrows = true;
foreach (DataRow dr in drParent)
{
ExtAspNet.TreeNode TN = new ExtAspNet.TreeNode();
TN.NodeID = dr["Menu_No"].ToString();
TN.Text = dr["Menu_Name"].ToString();
TN.IconUrl = dr["Menu_Ico"].ToString();
TN.OnClientClick = mainTabStrip.GetAddTabReference(dr["Menu_No"].ToString(), dr["Menu_Url"].ToString()+"?Menu_No="+dr["Menu_No"].ToString(), dr["Menu_Name"].ToString(), true);
TN.EnablePostBack = false;
tree.Nodes.Add(TN);
CreateNodes(ds, dr["Menu_No"].ToString(), TN);
}
}
/// <summary>
/// 绑定子目录
/// </summary>
protected void CreateNodes(DataSet ds, string PrentID, ExtAspNet.TreeNode TN)
{
DataRow[] drParent = ds.Tables[0].Select("Menu_ParentId='" + PrentID + "'");
foreach (DataRow dr in drParent)
{
ExtAspNet.TreeNode tn = new ExtAspNet.TreeNode();
tn.Text = dr["Menu_Name"].ToString();
tn.NodeID = dr["Menu_No"].ToString();
tn.IconUrl = dr["Menu_Ico"].ToString();
TN.OnClientClick = mainTabStrip.GetAddTabReference(dr["Menu_No"].ToString(), dr["Menu_Url"].ToString() + "?Menu_No=" + dr["Menu_No"].ToString(), dr["Menu_Name"].ToString(), true);
TN.EnablePostBack = false;
TN.Nodes.Add(tn);
//循环子节点看看是否还有下属节点
CreateNodes(ds, dr["Menu_No"].ToString(), tn);
}
}
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/)
Powered by Discuz! X3.4