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>

  • 相关阅读:
    1052. 爱生气的书店老板
    766. 托普利茨矩阵
    643.子数组的最大平均数I
    450. 删除二叉搜索树中的节点
    1489.找到最小生成树里的关键边和伪关键边
    839相似字符串
    1631.最小体力消耗路径
    SnowFlake雪花算法源码分析&灵活改造,常见分布式ID生成解决方案
    【目标检测】三、Faster R-CNN与R-FCN
    【目标检测】二、Fast R-CNN与SVD
  • 原文地址:https://www.cnblogs.com/happygx/p/1957950.html
Copyright © 2011-2022 走看看