asp.net中的菜单问题 [英] Problem with menu in asp.net
本文介绍了asp.net中的菜单问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码创建动态菜单:
I''m creating a dynamic menu using this code:
private void PopulateMenu()
{
DataSet ds = GetDataSetForMenu();
Menu menu = new Menu();
//menu.MenuItemClick += new MenuEventHandler(menu_MenuItemClick);
foreach (DataRow masterRow in ds.Tables[0].Rows)
{
MenuItem masterItem = new MenuItem(" " + (string)masterRow["pkg_name"] + " ");
menu.Items.Add(masterItem);
foreach (DataRow childRow in masterRow.GetChildRows("Children"))
{
MenuItem childItem = new MenuItem((string)childRow["city"] + "<hr />");
masterItem.ChildItems.Add(childItem);
childItem.NavigateUrl = ((string)childRow["url"]) + "?id=" + ((int)childRow["city_id"]);
}
}
//foreach (DataRow parentItem in ds.Tables["City"].Rows)
//{
// MenuItem categoryItem = new MenuItem((string)parentItem["city"]);
// menu.Items.Add(categoryItem);
// foreach (DataRow childItem in parentItem.GetChildRows("Children"))
// {
// MenuItem childrenItem = new MenuItem((string)childItem["Hotel_name"]);
// categoryItem.ChildItems.Add(childrenItem);
// }
//}
Panel1.Controls.Add(menu);
Panel1.DataBind();
}
private DataSet GetDataSetForMenu()
{
SqlConnection myConnection = new SqlConnection(GetConnectionString());
SqlDataAdapter adCat = new SqlDataAdapter("SELECT * FROM Package", myConnection);
SqlDataAdapter adProd = new SqlDataAdapter("SELECT * FROM City", myConnection);
DataSet ds = new DataSet();
adCat.Fill(ds, "Package");
adProd.Fill(ds, "City");
ds.Relations.Add("Children", ds.Tables["Package"].Columns["pkg_id"], ds.Tables["City"].Columns["pkg_id"], false);
return ds;
}
private string GetConnectionString()
{
string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
return connectionString;
}
菜单在面板中创建.我有一个锚牌酒店预订.我希望该面板在酒店预订的鼠标悬停时可见.我怎样才能做到这一点?
请指导我.
在此先感谢
The menu is created in the panel. I have an anchor tag hotel booking. I want the panel to be visible onmouseover of hotel booking. how can i do this?
Please guide me.
Thanks in advance
推荐答案
只看一下onmouseover属性.在菜单中...
just have a look over to onmouseover property..in ur posting u have not shown the design source..so it is difficult to find what problem in menu...
这篇关于asp.net中的菜单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文