我在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