如何取到ListView中的值?

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

墨色风雨
浏览 434回答 2
2回答

慕娘9325324

你的txtNum是哪个控件了啊?貌似你的控件ID是txtBuyNum
打开App,查看更多内容
随时随地看视频慕课网APP