}
</script>

<td class="lcolhead" onmouseover='openMenu("1")' style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px"
onmouseout='closeMenu("1")'>
//添加一个列
<A onmouseover='openMenu("1")' onmouseout='closeMenu("1")' href="#">
大生产作品</A>

//定义一个单独的层
<div class="unnamed1" >

//定义一个菜单
<div )'>
//添加一个表,容纳菜单
<table id=Table1 cellSpacing=1 cellPadding=1 width=120 border=0 align =center>
<tr>
<td align=center>

//加入DataGrid控件,并添加一列做菜单,将数据库中数据读出与此列邦定写形成菜单
<asp:DataGrid id=DataGrid1 runat="server" AutoGenerateColumns="False" ShowHeader="False" BorderWidth="0px">
<ItemStyle BorderColor="Transparent">
</ItemStyle>

//加入链接列
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="ID" DataNavigateUrlFormatString="http://localhost/Taile/Creativity/WebForm1.aspx?id={0}"

//显示数据库中的Name字段
DataTextField="Name">
<HeaderStyle Width="120px">
</HeaderStyle>

<ItemStyle Font-Italic="True">
</ItemStyle>
</asp:HyperLinkColumn>
</Columns>
</asp:DataGrid>
</td>
</tr>
</table>
</div>
</div>
</td class=lcolhead>
以上是aspx文件中要添加的代码

然后在aspx.cs文件中将数据读出邦定到datagrid1上即可用数据库中的Name字段来形成下菜单
如:
protected System.Web.UI.WebControls.DataGrid DataGrid1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here

DataView UserProductDataView=new DataView();

//获得数据库视图
UserProductDataView=(new UserProductBF()).GetUserProductType();

DataGrid1.DataSource=UserProductDataView;
DataGrid1.DataBind();
}
运行即可,

哈哈,比较简单,我目前是这样做的,不知道这样生成菜单好不好,其出来供大家参考,还望大家不要见笑才好。

相关文章:

  • 2022-03-02
  • 2021-06-19
  • 2021-11-29
  • 2022-01-24
  • 2021-06-30
  • 2022-01-07
  • 2022-02-27
猜你喜欢
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2021-07-31
  • 2021-07-03
  • 2022-12-23
  • 2021-07-25
相关资源
相似解决方案