我在Listview的 OnItemDataBound中给TextBox赋值了,当我单击了确认按钮的时候如何在OnItemCommand事件中取到TextBox值
<asp:ListView ID="lvMedics" runat="server" OnItemCommand="lvMedics_ItemCommand" OnItemDataBound="lvMedics_ItemDataBound">
<LayoutTemplate>
<asp:PlaceHolder ID="groupPlaceHolder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<GroupTemplate>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server"></asp:PlaceHolder>
</GroupTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval("MedicineName")%>
</td>
<td>
<asp:TextBox ID="txtBuyNum" runat="server" Width="60px"></asp:TextBox><span style="color: Red;
font-size: 12px;">(/件)</span>
</td>
<td>
<asp:Button runat="server" ID="btnBuy" Text="确认" CommandName="BuyFilter" CommandArgument='<%# Eval("Id") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
你的txtNum是哪个控件了啊?貌似你的控件ID是txtBuyNum
关注一下