我正在創建一個包含多個行的行(TR>)。在下面的代碼中;我將需要在下面突出顯示的部分中複製當月的天數控件。而不是手動寫入代碼的突出部分30或31次;有沒有更好的方法來完成它?需要重複控制當前天數
enter code here
<tr id="Tr4" style="height:72px" runat="server">
<td valign="top" colspan="1" align="center" class="Employee" width="150" style="display:none">
<asp:Label ID="lblCounter" name="lblCounter" runat="server" Text='<%# Container.DataItemIndex + 1 %>'/>
<td valign="top" colspan="1" align="center" class="Employee" width="150" style="display:none">
<asp:Label ID="lblRecordID" name="lblRecordID" runat="server" Text='<%#Eval("RecordID") %>'/>
</td>
</td>
<td valign="top" colspan="1" align="center" class="Employee" width="150" style="display:none">
<asp:Label ID="lblEmployeeID" name="lblEmployeeID" runat="server" Text='<%#Eval("EmployeeID") %>'/>
</td>
<td valign="top" colspan="1" align="center" class="Employee" width="150">
<asp:Label ID="lblEMployeeName" runat="server" Text='<%#Eval("EmployeeName")%>' />
</td>
'列= 「1」 風格= 「文本對齊:右」/>
<asp:Label ID="lblHoursWorked2" runat="server" Text='HoursWorked' />
<asp:TextBox ID="txtHoursWorked2" runat="server" AutoPostBack="true"
Text='' Columns="1" style="text-align:right"/>
<br />
<asp:Label ID="lblOTMealsPaid" runat="server" Text='Meals Paid'/>
<asp:TextBox ID="txtOTMealsPaid2" runat="server" AutoPostBack="true" Enabled="false"
Text='<%#Eval("OTMealsPaid") %>' Columns="1" style="text-align:right"/>
<br />
</td>
</tr>
</ItemTemplate>
我不能完全記住,但沒有.net有一個Repeater可以像for循環一樣使用? http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.aspx – WebDevNewbie 2012-08-10 20:59:18
@WebDevNewbie是的,它的確如此。還有一個「ListView」控件 – RandomWebGuy 2012-08-10 21:01:31