欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來(lái)到入門(mén)教程網(wǎng)!

C#教程

當(dāng)前位置:主頁(yè) > 軟件編程 > C#教程 >

C#實(shí)現(xiàn)DataList里面嵌套DataList的折疊菜單

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:C#教程|點(diǎn)擊: 次

本文實(shí)例講述了C#實(shí)現(xiàn)DataList里面嵌套DataList的折疊菜單。分享給大家供大家參考,具體如下:

點(diǎn)擊前效果圖如下:

點(diǎn)擊后效果圖如下:

具體實(shí)現(xiàn)代碼如下:

Javascript腳本

<script type="text/javascript">
function showmenu(id)
{
smallimg = eval("smallimg"+id);
img =eval("img"+id);
if(smallimg.style.display =="none")
{ 
eval("smallimg"+id+".style.display=\"\";");//全部顯示
img.src="Image/tree_folder3.gif";//顯示為-
}
else
{
eval("smallimg"+id+".style.display=\"none\";"); //全部隱藏
img.src="Image/tree_folder4.gif";//顯示為+
}
}
</script>

HTML代碼如下:

<body>
<form id="Form1" method="post" runat="server">
<font face="宋體"></font>
<table width="679" height="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center" valign="top">
<strong>版塊 設(shè) 置</strong>
<br />
<br />
管理選項(xiàng):<asp:Button ID="btnAdd" runat="server"
OnClick="btnAdd_Click" Text="添加一級(jí)版塊"/><br />
<br />
<asp:DataList ID="DataList1" runat="server" CellSpacing="0" CellPadding="0" Width="679"
OnItemDataBound="DataList1_ItemDataBound">
<HeaderTemplate>
<table width="679" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" class="border">
<tr bgcolor="#a4b6d7" class="title">
<td height="25" align="center">
<strong>版塊名稱(chēng)</strong></td>
<td height="20" align="center">
<strong>操作選項(xiàng)</strong></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="ECF5FF" class="tdbg">
<td height="22" width="50%">
<img id="img<%#Eval("BigClassID")%>" src="Image/tree_folder4.gif" width="15" height="15" onclick="showmenu(<%#Eval("BigClassID")%>)"><%#Eval("BigClassName")%></td>
<td align="center" width="50%">
<a href='SmallClassAdd.aspx?BigClassID=<%#Eval("BigClassID")%>'>
添加二級(jí)版塊</a> | <a href='BigClassModify.aspx?BigClassID=<%#Eval("BigClassID")%>'>
修改一級(jí)版塊</a> | <a href='BigClassDelete.aspx?BigClassID=<%#Eval("BigClassID")%>'
onclick="return confirm('確定刪除嗎,下級(jí)版塊及相關(guān)帖子都將被刪除,且不可恢復(fù)!!!')">刪除一級(jí)版塊</a></td>
</tr>
<tr bgcolor="ECF5FF" class="tdbg" width="100%">
<td colspan="2" width="100%">
<asp:DataList ID='dlstSmallClass' EnableViewState='false' runat='server'>
<HeaderTemplate>
<table width="679" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" class="border">
</HeaderTemplate>
<ItemTemplate>
<tr id="smallimg<%#Eval("BigClassID")%>" style="display:none" bgcolor="#E3E3E3" class="tdbg">
<td height="22" width="50%" colspan="3">
        
<img src="Image/tree_folder3.gif" width="15" height="15"><%#Eval("SmallClassName")%></td>
<td align="center" width="50%" colspan="3">
            
<a href='SmallClassModify.aspx?SmallClassID=<%#Eval("SmallClassID")%>'>
修改二級(jí)版塊</a> | <a href='SmallClassDelete.aspx?SmallClassID=<%#Eval("SmallClassID")%>'
onclick="return confirm('確定刪除嗎,相關(guān)帖子都將被刪除,且不可恢復(fù)!!!')">刪除二級(jí)版塊</a></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
</td>
</tr>
</table>
</form>
</body>

上面的功能有點(diǎn)缺陷(ques1:多行時(shí)候不能折疊,默認(rèn)只折疊第一行;ques2:不支持IE),現(xiàn)在改善如下:

<script type="text/javascript">
function showmenu(id)
{
var smallimg = document.getElementById("smallimg"+id);
var img = document.getElementById("img"+id);
if(smallimg.style.display =="none")
{ 
smallimg.style.display="";
img.src="Image/tree_folder3.gif";//顯示為-
}
else
{
smallimg.style.display ="none";
img.src="Image/tree_folder4.gif";//顯示為+
}
}
</script>

<body>
<form id="Form1" method="post" runat="server">
<font face="宋體"></font>
<table width="679" height="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center" valign="top">
<strong>版 塊 設(shè) 置</strong>
<br />
<br />
管理選項(xiàng):<asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="添加一級(jí)版塊"/><br />
<br />
<asp:DataList ID="DataList1" runat="server" CellSpacing="0" CellPadding="0" Width="679"
OnItemDataBound="DataList1_ItemDataBound">
<HeaderTemplate>
<table width="679" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000"class="border">
<tr bgcolor="#a4b6d7"class="title">
<td height="25" align="center">
<strong>版塊名稱(chēng)</strong>
</td>
<td height="20" align="center">
<strong>操作選項(xiàng)</strong>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="ECF5FF"class="tdbg">
<td height="22" width="50%">
<img id="img<%#Eval("BigClassID")%>" src="Image/tree_folder4.gif" width="15" height="15"
onclick="showmenu(<%#Eval("BigClassID")%>)"><%#Eval("BigC <td align="center" width="50%" colspan="3">
             <a href='SmallClassModify.aspx?SmallClassID=<%#Eval("SmallClassID")%>'>
修改二級(jí)版塊</a>|<a href='SmallClassDelete.aspx?SmallClassID=<%#Eval("SmallClassID")%>'
onclick="return confirm('確定刪除嗎,相關(guān)帖子都將被刪除,且不可恢復(fù)!!!')">刪除二級(jí)版塊</a>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
</td>
</tr>
</table>
</form>
</body>

希望本文所述對(duì)大家C#程序設(shè)計(jì)有所幫助。

上一篇:輕松學(xué)習(xí)C#的裝箱與拆箱

欄    目:C#教程

下一篇:輕松學(xué)習(xí)C#的基礎(chǔ)入門(mén)

本文標(biāo)題:C#實(shí)現(xiàn)DataList里面嵌套DataList的折疊菜單

本文地址:http://mengdiqiu.com.cn/a1/C_jiaocheng/6845.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有