最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時(shí)間:2015年11月18日 11:01:35   作者:mile  
這篇文章主要介紹了C#實(shí)現(xiàn)DataList里面嵌套DataList的折疊菜單,以實(shí)例形式詳細(xì)分析了DataList嵌套實(shí)現(xiàn)折疊菜單所涉及的JavaScript、HTML與C#相關(guān)使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(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>版塊&nbsp;設(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>版塊名稱</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">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<img src="Image/tree_folder3.gif" width="15" height="15"><%#Eval("SmallClassName")%></td>
<td align="center" width="50%" colspan="3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<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>版 塊&nbsp;設(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>版塊名稱</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">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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ì)有所幫助。

相關(guān)文章

  • C#中使用IFormattable實(shí)現(xiàn)自定義格式化字符串輸出示例

    C#中使用IFormattable實(shí)現(xiàn)自定義格式化字符串輸出示例

    這篇文章主要介紹了C#中使用IFormattable實(shí)現(xiàn)自定義格式字符串輸出示例,本文直接給出實(shí)例代碼,需要的朋友可以參考下
    2015-06-06
  • C#圖像邊緣檢測(cè)(Roberts)的方法

    C#圖像邊緣檢測(cè)(Roberts)的方法

    這篇文章主要介紹了C#圖像邊緣檢測(cè)(Roberts)的方法,涉及C#操作圖像的相關(guān)技巧,需要的朋友可以參考下
    2015-04-04
  • Unity Shader實(shí)現(xiàn)素描效果

    Unity Shader實(shí)現(xiàn)素描效果

    這篇文章主要為大家詳細(xì)介紹了Unity Shader實(shí)現(xiàn)素描效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-04-04
  • C#實(shí)現(xiàn)簡(jiǎn)易多人聊天室

    C#實(shí)現(xiàn)簡(jiǎn)易多人聊天室

    這篇文章主要為大家詳細(xì)介紹了C#實(shí)現(xiàn)簡(jiǎn)易多人聊天室,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • WPF自定義MenuItem樣式的實(shí)現(xiàn)方法

    WPF自定義MenuItem樣式的實(shí)現(xiàn)方法

    這篇文章主要給大家介紹了關(guān)于WPF自定義MenuItem樣式的實(shí)現(xiàn)方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用WPF具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-06-06
  • WinForm實(shí)現(xiàn)頁(yè)面按鈕定時(shí)隱藏功能

    WinForm實(shí)現(xiàn)頁(yè)面按鈕定時(shí)隱藏功能

    這篇文章主要介紹了WinForm實(shí)現(xiàn)頁(yè)面按鈕定時(shí)隱藏功能,結(jié)合實(shí)例形式分析了WinForm基于定時(shí)器的頁(yè)面控件屬性動(dòng)態(tài)操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下
    2017-05-05
  • 深入c# GDI+簡(jiǎn)單繪圖的具體操作步驟(二)

    深入c# GDI+簡(jiǎn)單繪圖的具體操作步驟(二)

    本篇文章是對(duì)GDI+簡(jiǎn)單繪圖的繪圖知識(shí)進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
    2013-05-05
  • C# 數(shù)組刪除元素的實(shí)現(xiàn)示例

    C# 數(shù)組刪除元素的實(shí)現(xiàn)示例

    本文主要介紹了C# 數(shù)組刪除元素的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-08-08
  • c# 模擬線性回歸的示例

    c# 模擬線性回歸的示例

    這篇文章主要介紹了c# 模擬線性回歸的示例,幫助大家利用c#進(jìn)行機(jī)器學(xué)習(xí),感興趣的朋友可以了解下
    2020-10-10
  • C#中using關(guān)鍵字的使用方法示例

    C#中using關(guān)鍵字的使用方法示例

    在C#語(yǔ)句中,將using關(guān)鍵字作為一個(gè)語(yǔ)句時(shí),該語(yǔ)句的作用是定義一個(gè)用大括號(hào)規(guī)定的范圍,在該范圍的末尾,系統(tǒng)會(huì)立即釋放using后小括號(hào)內(nèi)指定的對(duì)象,下面這篇文章主要給大家介紹了關(guān)于C#中using關(guān)鍵字使用的相關(guān)資料,需要的朋友可以參考下
    2022-06-06

最新評(píng)論

油尖旺区| 封丘县| 牡丹江市| 屏东市| 肥城市| 桂林市| 松潘县| 仙桃市| 随州市| 安图县| 顺昌县| 新沂市| 南开区| 西吉县| 大渡口区| 扬州市| 北宁市| 那曲县| 渭源县| 永仁县| 和林格尔县| 揭西县| 松滋市| 军事| 遂溪县| 晋中市| 上林县| 大连市| 独山县| 西峡县| 白水县| 安丘市| 贡觉县| 茂名市| 安康市| 安仁县| 健康| 长春市| 北流市| 呈贡县| 乌审旗|