日期:2014-05-17  浏览次数:20660 次

asp:Repeater 为何不显示数据?
初学asp.net
在51aspx下了一个开源的项目打算边修改边学
在后台那里模仿登陆和修改用户密码功能都成功
但是在查询用户列表的时候用的asp:Repeater就不显示数据了,项目自己的列表就能出来,我模仿的后台用户列表就出不来了,后台代码那里SQL语句是没有问题的,在数据库里能查出数据。但是asp:Repeater里面我查看源代码却只有input,不见循环出来的表格

aspx文件
HTML code

<form id="form1" runat="server">
        <div>
            <asp:Repeater ID="rptList" runat="server">
            <HeaderTemplate>
          <table width="98%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="31" background="../images/d2.jpg"><table width="100%"  border="0" cellpadding="5" cellspacing="0">
                <tr>
                  <td width="5%"><div align="center"><STRONG>序号</STRONG></div></td>
                  <td width="18%"><div align="center"><STRONG>权限</STRONG></div></td>
                  <td width="41%"><div align="center"><STRONG>用户名</STRONG></div></td>
                  <td width="38%"><div align="center"><STRONG>操作</STRONG></div></td>
                </tr>
              </table></td>
            </tr>
            </HeaderTemplate>
            <ItemTemplate>
            <tr>
              <td>

              <table width="100%"  border="0" cellpadding="0" cellspacing="0" background="images/x1.jpg">

            <tr onmouseover="this.bgColor='#D6DD2F'" onmouseout="this.bgColor='#FFFFFF'">
            <!--
            <tr bgcolor="#F3F7FA" onmouseover="this.bgColor='#D6DD2F'" onmouseout="this.bgColor='#F3F7FA'">
            -->
                <td><table width="100%"  border="0" cellpadding="0" cellspacing="0">              
                <tr>
                  <td width="5%" height="38" class="p12d2"><asp:Label ID="lb_id" runat="server" Text='<%# Eval("Id")%>' Visible="False"></asp:Label></td>
                  <td width="18%"><%# Eval("UserType").ToString().Trim() == "1" ? "<span>超级管理员</span>" : "<span>普通管理员</span>"%>
                  </td>
                  <td width="41%"><%# Eval("UserName")%></td>
                  <td width="38%"><table width="70%"  border="0" align="right" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="10%"><img src="../images/g2.jpg" width="14" height="16"></td>
                      <td width="40%"><span><a href="user_updateform.aspx?id=<%# Eval("Id") %>">修改</a></span></td>
                      <td width="10%"><img src="../images/g3.jpg" width="13" height="13"></td>
                      <td width="40%"><span><a href="user_updateform.aspx?id=<%# Eval("Id") %>">删除</a></span></td>
                    </tr>
                  </table></td>
                </tr>
                <tr bgcolor=&quo