如何在下面的 asp.net 中使用 For 循环?我尝试使用 <% for(int i=0; i<5; i++)%> 这给了我语法错误。我已经厌倦了“糟糕!您的编辑无法提交,因为:”的消息:
<asp:ListView runat="server" ID="EmployeesListView" DataSourceID="EmployeesDataSource" DataKeyNames="EmployeeID" OnDataBound="grd_RowDataBound">
<LayoutTemplate>
<table cellpadding="2" runat="server" id="tblEmployees" name="tblEmployees" style="width:100%" color="green">
<tr id="Tr3" runat="server" style="background-color: red; color: yellow">
<th id="lbl1" style="display:none">Record No.</th>
</tr>
<tr runat="server" id="itemPlaceholder"></tr>
</table>
<asp:DataPager runat="server" ID="DataPager" PageSize="5">
<Fields>
<asp:NumericPagerField ButtonCount="5" PreviousPageText="<--" NextPageText="-->" />
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate>
<td valign="top" class="tdWithBorder" width="165" align="right" style="background-color: #D7E0EC; color: blue">
<asp:Label ID="lblCallStatus" runat="server" Text='Call Status' />
<br />
<asp:Label ID="lblHoursWorked1" runat="server" Text='HoursWorked' />
<br />
<asp:Label ID="lblOTMealsPaid" runat="server" Text='Meals Paid'/>
<br />
</td>
</tr>
</ItemTemplate>