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

推荐订阅源

S
Security @ Cisco Blogs
H
Hacker News: Front Page
P
Privacy International News Feed
N
News and Events Feed by Topic
T
Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
S
Schneier on Security
K
Kaspersky official blog
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
Security Latest
Security Latest
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
L
Lohrmann on Cybersecurity
Jina AI
Jina AI
P
Proofpoint News Feed
AI
AI
雷峰网
雷峰网
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 叶小钗
Webroot Blog
Webroot Blog
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
罗磊的独立博客
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
S
Security Affairs
Blog — PlanetScale
Blog — PlanetScale
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
月光博客
月光博客
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Securelist
W
WeLiveSecurity
T
Troy Hunt's Blog
A
Arctic Wolf
博客园 - 司徒正美

博客园 - 古道飘零客

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();
        }
    }
}