Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用asp.net处理repeater标记的此问题?_C#_Asp.net - Fatal编程技术网

C# 如何使用asp.net处理repeater标记的此问题?

C# 如何使用asp.net处理repeater标记的此问题?,c#,asp.net,C#,Asp.net,我正在使用C为ASP.NET中的表使用转发器# 我正在尝试将中继器设置为使用默认的26行 不管我有多少信息 如果我有更少的信息,我希望该行的其余部分为空,如果我有超过26行的信息,它应该转到第二、第三页,等等 我该怎么办 这是我的密码 <asp:Repeater ID="Repeater1" runat="server" DataSourceID="sqltoolinv1" > <HeaderTemplate> <table style="wi

我正在使用C为ASP.NET中的表使用转发器#

我正在尝试将中继器设置为使用默认的26行

不管我有多少信息

如果我有更少的信息,我希望该行的其余部分为空,如果我有超过26行的信息,它应该转到第二、第三页,等等

我该怎么办

这是我的密码

 <asp:Repeater ID="Repeater1" runat="server" DataSourceID="sqltoolinv1"  >
   <HeaderTemplate>
      <table style="width: 86.7%; border-collapse: collapse; border: 1px solid black;" align="center">
         <tr align="center" class="text" style="background-color: gray">
            <th style="width: 5.14%;">No.</th>
            <th style="width: 20.22%;">Tool Nomenclature or Description</th>
            <th style="width: 11.4%;">Purchase Date</th>
            <th style="width: 9.56%;">Original Cost</th>
            <th style="width: 9.93%;">Condition of Tool</th>
            <th style="width: 8.456%;">Drawer or Shelf</th>
            <th style="width: 21.32%;">Remarks</th>
         </tr>
   </HeaderTemplate>
   <ItemTemplate>
   <tr align="left">
   <td>
   <asp:Label runat="server" ID="lbnum"
      Text='<%# Eval("ID") %>' /></td>
   <td>
   <asp:Label runat="server" ID="lbtname"
      Text='<%# Eval("Description") %>' /></td>
   <td>
   <asp:Label runat="server" ID="lbpurdate"
      Text='<%# Eval("[Purchase_Date]") %>' /></td>
   <td>
   <asp:Label runat="server" ID="lboricost"
      Text='<%# Eval("Cost") %>' DataFormatString="{0:C}" /></td>
   <td>
   <asp:Label runat="server" ID="lbtoolcond"
      Text='<%# Eval("Condition") %>' /></td>
   <td>
   <asp:Label runat="server" ID="lbshelf"
      Text='<%# Eval("Location") %>' /></td>
   <td>
   <asp:Label runat="server" ID="lbremarks"
      Text='<%# Eval("Remarks") %>' /></td>
   </tr>
   </ItemTemplate>
   <FooterTemplate>
   </table>
   </FooterTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="sqltoolinv1" runat="server"
   ConnectionString="<%$ connectionstrings:webserverconnectionstring %>"
   SelectCommand="SELECT [ID],[Description],[Purchase Date] AS [Purchase_Date],[Cost],[Condition],[Location],[Remarks] FROM [EmpPortalToolInv] WHERE [Payroll] = @Payroll ORDER BY [ID]">
   <SelectParameters>
      <asp:SessionParameter Name="Payroll" SessionField="Payroll" DbType="String" />
   </SelectParameters>
</asp:SqlDataSource>

不
工具术语或描述
购买日期
原价
刀具状况
抽屉或架子
评论

我不确定这是否可行。但您可以限制发送内容列表中的数据

var firstPageItems = myList.Take(26);
var secondPageItems = myList.Skip(26).Take(26);

Repeater1.DataSource = firstPageItems;
Repeater1.DataBind();

您可以通过js来创建项目页面

例如:


至于您关于最少26行的问题,我不知道该怎么办。但是关于分页,对于
中继器来说,这并不是现成的。您可能需要查看
DataGrid
GridView
控件。他们将为您创建具有更优雅的分页解决方案的表。