zoukankan      html  css  js  c++  java
  • Repeater

    在Repeater1中点击 点击查看详情按钮 在Reperter2中显示信息

    protected void _details(object sender,EventArgs e)
            {
                this.Panel2.Visible=true;
                HtmlAnchor a = (HtmlAnchor)sender;//取出reperter1中的a标签中的内容
               int productid=Convert.ToInt32(a.Title.ToString());//取出a标签中title上绑定的值

                 //绑定
               string sql = string.Format("select Description from Products.dbo.Products where productid='{0}'", productid);
                DataSet ds = CM.DataAccess.dataDrive.Welanerp.connProcedureExecSql(sql);
                this.Repeater2.DataSource = ds;
                this.Repeater2.DataBind();
            }

    <asp:Panel ID="Panel1" runat="server" Visible="true">
            <asp:Repeater ID="Repeater1" runat="server">
                <HeaderTemplate>
                    <table width="100%" cellspacing="1" cellpadding="0" class="underline">
                        <tr style="height: 40px" align="center">
                        <th>书名</th>
                        <th>作者</th>
                        <th>出版社</th>
                        <th>ISBN</th>
                        <th>内容简介</th>
                        <th>图书编号</th>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
             
      <tr align="center" style=" background-color:Green ">
                <td><%#Eval("ProductName")%></td>
                <td><%#Eval("AuthorNames")%></td>
                <td><%#Eval("ManufacturerName")%></td>
                <td><%#Eval("BarCode")%></td>
                <td><%#Eval("Description")%></td>

               //显示详情按钮  注:鼠标点击时间必须为onserverclick(按钮点击时间在后台编写 即上)
                <td><a id="Seache" href="javascript:" runat="server" title='<%#Eval("ProductID") %>' onserverclick="_details">详细信息</a></td>
                </tr>
                </ItemTemplate>

                 //隔行颜色效果

                <AlternatingItemTemplate>
                <tr align="center" style=" background-color:red">
                <td><%#Eval("ProductName")%></td>
                <td><%#Eval("AuthorNames")%></td>
                <td><%#Eval("ManufacturerName")%></td>
                <td><%#Eval("BarCode")%></td>
                <td><%#Eval("Description")%></td>
                <td><a id="Seache" href="javascript:" runat="server" title='<%#Eval("ProductID") %>' onserverclick="_details">详细信息</a></td>

               </AlternatingItemTemplate>


                <FooterTemplate>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
        </asp:Panel>


        <asp:Panel ID="Panel2" runat="server" Visible="false">
            <asp:Repeater ID="Repeater2" runat="server">
            <HeaderTemplate>
            <table width="100%" cellspacing="1" cellpadding="0">
             <tr align="center">
             <th>描述</th>
             </tr>
            </HeaderTemplate>
            <ItemTemplate>
            <tr align="center">
            <td> <%#Eval("Description")%></td>
            </tr>
            </ItemTemplate>
            <FooterTemplate>
            </table>
            </FooterTemplate>
            </asp:Repeater>
        </asp:Panel>

  • 相关阅读:
    【Android Developers Training】 105. 显示一个位置地址
    【Android Developers Training】 104. 接受地点更新
    【Android Developers Training】 103. 查询当前地点
    【Android Developers Training】 102. 序言:让你的应用获知地点
    【Android Developers Training】 101. 显示快速联系人挂件(Quick Contact Badge)
    Agent admitted failure to sign using the key
    谷歌大牛Jeff Dean是如何成为互联网战神的
    mount挂载错误
    linux mount (挂载命令)详解
    出现Fatal IO error 11 (资源暂时不可用) on X server :0.0.的可能原因及解决方案
  • 原文地址:https://www.cnblogs.com/happygx/p/1957950.html
Copyright © 2011-2022 走看看