zoukankan      html  css  js  c++  java
  • .NET ------ Repeater 遍历数据显示在页面上

    做一个日志查看

     借助repeater 进行遍历输出数据

    前面主要代码

        <table width="100%" cellpadding="4" cellspacing="0" class="tablecolor" id="divtable" style="white-space: nowrap">
           <tr bgcolor="#EEEEEE">
           <td  style="white-space: nowrap" align="center">学号</td>
           <td  style="white-space: nowrap" align="center">姓名</td>
           <td  style="white-space: nowrap" align="center">日志</td>
           <td  style="white-space: nowrap" align="center">登记人</td>
     
           </tr>
        <asp:Repeater ID="RepeaterStudentLog" runat="server">
        <ItemTemplate>
               <tr bgcolor="#FFFFFF" onMouseOver="this.bgColor='#FEFEFA'" onMouseOut="this.bgColor='#FFFFFF'" onclickX="javascript:document.getElementById('CheckData<%# Container.ItemIndex %>').checked=true;">
               <td  style="white-space: nowrap" align="center" <%# DataBinder.Eval(Container.DataItem,"RowColor") %>><%# DataBinder.Eval(Container.DataItem, "StuMark") %></td>
               <td  style="white-space: nowrap" align="center" <%# DataBinder.Eval(Container.DataItem,"RowColor") %>><%# DataBinder.Eval(Container.DataItem,"StuName") %>&nbsp;</td>
               <td  style="white-space: nowrap" align="center" <%# DataBinder.Eval(Container.DataItem,"RowColor") %>><%# DataBinder.Eval(Container.DataItem, "LogContent") %></td>
               <td  style="white-space: nowrap" align="center" <%# DataBinder.Eval(Container.DataItem,"RowColor") %>><%# DataBinder.Eval(Container.DataItem, "CreateUserID") %></td>
               </tr>
        </ItemTemplate>
        </asp:Repeater>
        </table>

    后面将查出的集合复制给 repeater

        private void DataLoad()
        {
            bllStudentLog bllstudentlog = new bllStudentLog();
            List<StudentLog> mliststudentlog = bllstudentlog.GetListSelStudentLog3("*", base.EnterpriseGuid, " and StudentGuid = '" + _StuGuid + "'");
            this.RepeaterStudentLog.DataSource = mliststudentlog;
            this.RepeaterStudentLog.DataBind();
    
            //for (int i = 0; i <= mliststudentlog.Count - 1; i++)
            //{
    
            //    this.tbStuMark.Text = mliststudentlog[i].StuMark.ToString() + "&nbsp;";//学号
            //    this.tbStuName.Text = mliststudentlog[i].StuName.ToString() + "&nbsp;";//姓名
            //    this.tbLogContent.Text = mliststudentlog[i].LogContent.ToString() + "&nbsp;";//日志内容         
            //    this.tbCreateUserID.Text = mliststudentlog[i].CreateUserID.ToString() + "&nbsp;";//操作员
            //}
            
                   
        }
  • 相关阅读:
    设计模式的征途—12.享元(Flyweight)模式
    设计模式的征途—11.外观(Facade)模式
    UML类图10分钟快速入门
    设计模式的征途—10.装饰(Decorator)模式
    设计模式的征途—9.组合(Composite)模式
    设计模式的征途—8.桥接(Bridge)模式
    我的2017OKR
    设计模式的征途—7.适配器(Adapter)模式
    《白夜行》读后感:白夜行走,暗中羁绊
    设计模式的征途—6.建造者(Builder)模式
  • 原文地址:https://www.cnblogs.com/obge/p/13450708.html
Copyright © 2011-2022 走看看