惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Palo Alto Networks Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
S
Schneier on Security
S
Securelist
酷 壳 – CoolShell
酷 壳 – CoolShell
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cyberwarzone
Cyberwarzone
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
GbyAI
GbyAI
Security Latest
Security Latest
Last Week in AI
Last Week in AI
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
Webroot Blog
Webroot Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
C
Cisco Blogs
博客园 - 【当耐特】
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
B
Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Attack and Defense Labs
Attack and Defense Labs
The Last Watchdog
The Last Watchdog
U
Unit 42
阮一峰的网络日志
阮一峰的网络日志
Project Zero
Project Zero
WordPress大学
WordPress大学
L
LINUX DO - 最新话题
F
Fortinet All Blogs
L
LINUX DO - 热门话题
PCI Perspectives
PCI Perspectives
Simon Willison's Weblog
Simon Willison's Weblog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
MongoDB | Blog
MongoDB | Blog
Latest news
Latest news
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
The Hacker News
The Hacker News
爱范儿
爱范儿
O
OpenAI News
J
Java Code Geeks
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - 古道飘零客

Easyui combogrid添加toolbar SQL导出到Excel 存储过程 [WPF]DataGrid行前景色根据单元格编辑值变色 [转]系统性能调优吐血总结分享 [转]C#读取CSV,Excel,Txt文件,删除文件,拷贝文件 [转]C# 文件操作 全收录 追加、拷贝、删除、移动文件、创建目录、递归删除文件夹及文件.... JS四舍五入BUG解决 IIRF(Ionics Isapi Rewrite Filt er)实现在IIS 5/6上重写Url JS和CS互访(非常经典) [转]IList及泛型集合类转换DataTable - 古道飘零客 - 博客园 关于sqlserver2005中的bit数据类型 C#小写转大写 - 古道飘零客 - 博客园 URL、Session、Cookies、Server.Transfer、Application和跨页面传送详解 sql server 2005 安装提示COM+ 和性能监视器计数器要求错误 oracle数据分组排名次 [转cnblogs]网页静态 js如何判断小数点后有几位? - 古道飘零客 - 博客园 怎样读取本地Excel数据,并保存到时服务器 - 古道飘零客 - 博客园 C#项目打包,并自动安装SQL数据库 - 古道飘零客 - 博客园
Repeater控件实现左侧快捷菜单 - 古道飘零客 - 博客园
古道飘零客 · 2010-05-17 · via 博客园 - 古道飘零客

<head runat="server">
    <title>无标题页</title>
<style type="text/css">
h3{height:28px;line-height:28px;width:182px;background-image:url(Images/menu_bg1.gif);background-repeat:no-repeat;font-size:13px;padding-left:30px;cursor:pointer;margin:0;}
td a:link,td a:visited{display:block;height:28px;line-height:28px;width:182px;background-image:url(Images/menu_bg1.gif);background-repeat:no-repeat;padding-left:60px;}
td a:hover{background-image:url(Images/menu_bg2.gif);background-repeat:no-repeat;}
div{margin:0;padding:0;}
</style>
<script type="text/javascript">
function ShowOrHide(obj)
{
if(obj.parentNode.childNodes(1).style.display == "none")
    obj.parentNode.childNodes(1).style.display = "block";
else
    obj.parentNode.childNodes(1).style.display = "none";
}
</script>
</head>
<body style="width:960px;margin:0 auto;padding:0;background-color:#FFFFFF;font-size:13px;">
    <form id="form1" runat="server">
    <div style="width:300px;float:left;">
      <div>
        <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
          <ItemTemplate>
            <div>
              <div onclick="ShowOrHide(this)">
                <h3><asp:Literal ID="Literal1" runat="server"></asp:Literal></h3>
              </div>
              <div style="margin:0;padding:0;display:none;">
                <table border="0" cellspacing="0">
                  <asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound">
                    <ItemTemplate>
                      <tr>
                        <td><asp:HyperLink ID="HyperLink1" runat="server"></asp:HyperLink></td>
                      </tr>
                    </ItemTemplate>
                  </asp:Repeater>
                </table>
              </div>
            </div>
          </ItemTemplate>
          <AlternatingItemTemplate>
            <div>
              <div onclick="ShowOrHide(this)">
                <h3><asp:Literal ID="Literal1" runat="server"></asp:Literal></h3>
              </div>
              <div style="margin:0;padding:0;display:none;">
                <table border="0" cellspacing="0">
                  <asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound">
                    <ItemTemplate>
                      <tr>
                        <td><asp:HyperLink ID="HyperLink1" runat="server"></asp:HyperLink></td>
                      </tr>
                    </ItemTemplate>
                  </asp:Repeater>
                </table>
              </div>
            </div>
          </AlternatingItemTemplate>
        </asp:Repeater>
      </div>
      <div style="width:650px;float:right;">
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
        </asp:contentplaceholder>
      </div>
       
    </div>
    </form>
</body>
</html>


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MasterPage : System.Web.UI.MasterPage
{
    DB db = new DB();
    string Query = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Repeater1ItemDataBound();
            Repeater2ItemDataBound();
        }
    }

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Literal l = e.Item.FindControl("Literal1") as Literal;
            l.Text = DataBinder.Eval(e.Item.DataItem, "title").ToString();
        }
    }

    protected void Repeater2_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            HyperLink h = e.Item.FindControl("HyperLink1") as HyperLink;
            h.Text = DataBinder.Eval(e.Item.DataItem, "subTitle").ToString();
            h.NavigateUrl = DataBinder.Eval(e.Item.DataItem, "connectTo").ToString();
            h.Target = "_blank";
        }
    }

    private void Repeater1ItemDataBound()
    {
        Query = "SELECT * FROM [title]";
        DataTable table = db.GetDataTable(Query);
        Repeater1.DataSource = table;
        Repeater1.DataBind();
    }

    private void Repeater2ItemDataBound()
    {
        foreach (RepeaterItem item in Repeater1.Items)
        {
            Literal l = item.FindControl("Literal1") as Literal;
            Repeater Repeater2 = item.FindControl("Repeater2") as Repeater;
            Query = "SELECT A.* FROM [subTitle] A,[title] B WHERE A.[titleID]=B.[id] AND B.[title]='" + l.Text + "'";
            DataTable table = db.GetDataTable(Query);
            Repeater2.DataSource = table;
            Repeater2.DataBind();
        }
    }
}