我在Asp.net 4.0中有一個ListView控件C# 我正在嘗試使默認模式=編輯模式與文本框。所以我拿了Item Template(默認模板)並用TextBox替換了我的數據綁定標籤。 它工作正常。除文本框外只適用於其他行。因此,一半的行是Page Load的文本框,一半的Roes仍然是標籤。這裏是我的代碼:在默認編輯模式下創建一個ListView控件
<ItemTemplate>
<tr style="">
<td>
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
</td>
<td>
<asp:TextBox ID="DiscountPercentageTextBox" runat="server"
Text='<%# Bind("DiscountPercentage") %>' />
</td>
<td>
<asp:TextBox ID="CashTextBox" runat="server" Text='<%# Bind("Cash") %>' />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table>
<thead>
<tr>
<th>Title </th>
<th>DiscountPercentage</th>
<th>Cash</th>
</tr>
</thead>
<tbody>
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</tbody>
</table>
</LayoutTemplate>
這裏是結果:
你明白嗎?每隔一行都是一個文本框。我需要所有行爲文本框。我究竟做錯了什麼?
人們仍然使用Webforms?! – Jack 2012-03-01 20:55:56