主题:用datalist显示二级菜单?
在连接库都正常的条件下:
在<td><A onmousedown="MM_goToURL('parent.frames[\'main\']','Content.aspx?tabindex=0&connum=0');return document.MM_returnValue"
id="href1" onmouseover="MM_swapImage('Image1','','file:///C|/Inetpub/wwwroot/WebS/button/mainbutton_0out.jpg',1)"
onmouseout="MM_swapImgRestore()" href="top.aspx?id=0"><img></a></td>中这样处理(这是一级菜单).
//////////////////////////////////
<td style="HEIGHT: 1px" vAlign="middle" align="left">
<table cellSpacing="0" cellPadding="0" width="400" border="1">
<tr>
<td><asp:datalist id="DataList1" runat="server" RepeatDirection="Horizontal" Width="311px" Height="15px"
ShowHeader="False" ShowFooter="False" BorderWidth="0px" CellPadding="0" GridLines="Horizontal"
BorderStyle="Dotted" HorizontalAlign="Left" ToolTip="fghfdgh" BorderColor="#C0C000">
<SelectedItemStyle BorderColor="Red"></SelectedItemStyle>
<SeparatorStyle Wrap="False" HorizontalAlign="Left" VerticalAlign="Middle"></SeparatorStyle>
<ItemStyle Font-Size="8pt" Wrap="False" HorizontalAlign="Left" VerticalAlign="Bottom"></ItemStyle>
<ItemTemplate>
<!-- -->
<a href='<%# DataBinder.Eval(Container.DataItem,"url")%>' target='main'><font size="2">
<%# DataBinder.Eval(Container.DataItem,"name")%>
</font></a>
</ItemTemplate>
<SeparatorTemplate>
<font face="宋体">|</font>
</SeparatorTemplate>
</asp:datalist></td>
</tr>
</table>
</td>
这是处理的二级菜单.
在后台private void DataList1_Init(object sender, System.EventArgs e)
{
string ID=Request.QueryString["id"];
DataTable Tabs=(new CatalogDB()).GetTab(ID);
int count = Tabs.Rows.Count;
DataList1.Width=50;
DataList1.DataSource=Tabs;
DataList1.DataBind();
}
问题一::为什么不执行这段代码??DataList1_Init()在什么条件下触发??
问题二::在处理一级菜单时,href="top.aspx?id=0"如何能够触发啊?
在<td><A onmousedown="MM_goToURL('parent.frames[\'main\']','Content.aspx?tabindex=0&connum=0');return document.MM_returnValue"
id="href1" onmouseover="MM_swapImage('Image1','','file:///C|/Inetpub/wwwroot/WebS/button/mainbutton_0out.jpg',1)"
onmouseout="MM_swapImgRestore()" href="top.aspx?id=0"><img></a></td>中这样处理(这是一级菜单).
//////////////////////////////////
<td style="HEIGHT: 1px" vAlign="middle" align="left">
<table cellSpacing="0" cellPadding="0" width="400" border="1">
<tr>
<td><asp:datalist id="DataList1" runat="server" RepeatDirection="Horizontal" Width="311px" Height="15px"
ShowHeader="False" ShowFooter="False" BorderWidth="0px" CellPadding="0" GridLines="Horizontal"
BorderStyle="Dotted" HorizontalAlign="Left" ToolTip="fghfdgh" BorderColor="#C0C000">
<SelectedItemStyle BorderColor="Red"></SelectedItemStyle>
<SeparatorStyle Wrap="False" HorizontalAlign="Left" VerticalAlign="Middle"></SeparatorStyle>
<ItemStyle Font-Size="8pt" Wrap="False" HorizontalAlign="Left" VerticalAlign="Bottom"></ItemStyle>
<ItemTemplate>
<!-- -->
<a href='<%# DataBinder.Eval(Container.DataItem,"url")%>' target='main'><font size="2">
<%# DataBinder.Eval(Container.DataItem,"name")%>
</font></a>
</ItemTemplate>
<SeparatorTemplate>
<font face="宋体">|</font>
</SeparatorTemplate>
</asp:datalist></td>
</tr>
</table>
</td>
这是处理的二级菜单.
在后台private void DataList1_Init(object sender, System.EventArgs e)
{
string ID=Request.QueryString["id"];
DataTable Tabs=(new CatalogDB()).GetTab(ID);
int count = Tabs.Rows.Count;
DataList1.Width=50;
DataList1.DataSource=Tabs;
DataList1.DataBind();
}
问题一::为什么不执行这段代码??DataList1_Init()在什么条件下触发??
问题二::在处理一级菜单时,href="top.aspx?id=0"如何能够触发啊?