FineUI 官方论坛
标题:
ExtAspNet创建手风琴菜单没有显示数据库菜单信息,求助
[打印本页]
作者:
做了才会想好
时间:
2013-3-24 03:32
标题:
ExtAspNet创建手风琴菜单没有显示数据库菜单信息,求助
ExtAspNet创建手风琴菜单没有显示数据库菜单信息,求助
protected void Page_Init(object sender, EventArgs e)
{
LoadData();
}
private ExtAspNet.Accordion LoadData()
{
SqlConnection conn = Sqlhelper.conn;
string selectcmd = "select z_id,z_parentid,z_name from userzutest where z_id<>2";
SqlDataAdapter da = new SqlDataAdapter(selectcmd, conn);
ExtAspNet.Tree Tree1 = new ExtAspNet.Tree();
// 模拟从数据库返回数据表
// DataTable table = CreateDataTable();
conn.Open();
DataSet ds = new DataSet();
da.Fill(ds);
// ds.Tables.Add(table);
ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["z_id"], ds.Tables[0].Columns["z_parentid"], false);
ExtAspNet.Accordion accordion = new ExtAspNet.Accordion();
accordion.ShowBorder = false;
accordion.ShowHeader = false;
foreach (DataRow row in ds.Tables[0].Rows)
{
if (row["z_parentid"].Equals(1))
{
AccordionPane accordionPane = new AccordionPane();
accordion.Panes.Add(accordionPane);
accordionPane.Title = row["z_name"].ToString();
accordionPane.ShowBorder = false;
accordionPane.BodyPadding = "2px 0 0 0";
ExtAspNet.Tree tree = new ExtAspNet.Tree();
accordionPane.Items.Add(tree);
tree.ShowBorder = false;
tree.ShowHeader = false;
tree.AutoScroll = true;
tree.EnableArrows = true;
ResolveSubTree(row,tree.Nodes);
}
}
conn.Close();
return accordion;
}
/*******************************************************************************************************/
private void ResolveSubTree(DataRow dataRow, ExtAspNet.TreeNodeCollection nodes)
{
DataRow[] rows = dataRow.GetChildRows("TreeRelation");
if (rows.Length > 0)
{
foreach (DataRow row in rows)
{
ExtAspNet.TreeNode node = new ExtAspNet.TreeNode();
node.Expanded = true;
nodes.Add(node);
node.Text = row["z_name"].ToString();
node.NavigateUrl = "http://www.baidu.com";
ResolveSubTree(row, node.Nodes);
}
}
}
作者:
sanshi
时间:
2013-3-27 11:10
请完整描述问题,并提供示例工程
作者:
不回头的执着
时间:
2013-8-4 20:13
我现在也遇到这个问题,正在找答案,连那个加号都不见
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/)
Powered by Discuz! X3.4