updatepanel中gridview中的文本框值

时间:2015-09-18 10:21:38

标签: updatepanel

尝试在按钮单击后,在更新面板内的gridview中从名为tbAantalgv的文本框中获取值。数据绑定后tbAantalgv = 0的标准值,但是当我将文本框值更改为1时,文本框值不会更改。

    For Each gvr As GridViewRow In gvOnderdelenLos.Rows
        If gvr.RowType = DataControlRowType.DataRow Then
            Dim lblCode As Label = gvr.FindControl("lblCode")
            Dim lblArtikel As Label = gvr.FindControl("lblArtikel")
            Dim tbAantalgv As TextBox = gvr.FindControl("tbAantalgv")

        End If
    Next

    <asp:UpdatePanel ID="pnlOnderdelenLos" runat="server" style="width:95%; border:solid 3px white; display:none;" UpdateMode="Conditional" >
    <ContentTemplate>
        <asp:ImageButton ID="imgOnderdelenLosToevoegen" runat="server" OnClientClick="imgOnderdelenLosToevoegen()" ImageUrl="~/Afbeeldingen/Icons/table_row_insert.png" 
            style="vertical-align:text-top; float:right; margin-right:2%" />

                <asp:SqlDataSource ID="dsOnderdelenLos" runat="server" ConnectionString="<%$ ConnectionStrings:AftersalesConnectionString %>"
                    SelectCommand="EXEC spAppPnlOnderdelenLos">
                </asp:SqlDataSource>
                <asp:GridView ID="gvOnderdelenLos" runat="server" DataSourceID="dsOnderdelenLos" AllowSorting="False" PagerSettings-PageButtonCount="20" ShowHeader="false" 
                    AllowEditing="True" AutoGenerateColumns="False" CellPadding="3" GridLines="Both" AllowPaging="False" style="width:100%; margin-left:2px;">
                    <HeaderStyle CssClass="Gridview" />
                    <Columns>
                        <asp:TemplateField HeaderText="Artikelnummer" SortExpression="Code" ItemStyle-Width="25%" >
                            <ItemTemplate>
                                <asp:Label ID="lblCode" runat="server" Text='<%# Bind("Code")%>' ></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Artikel" SortExpression="Omschrijving" ItemStyle-Width="25%">
                            <ItemTemplate>
                                <asp:Label id="lblArtikel" runat="server" Text='<%# Bind("Omschrijving")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Aantal" SortExpression="Aantal" ItemStyle-Width="25%">
                            <ItemTemplate>
                                <asp:TextBox id="tbAantalgv" runat="server" Width="95%" text='<%# Bind("Aantal")%>'></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Kostenplaats" SortExpression="Kostenplaats" ItemStyle-Width="25%">
                            <ItemTemplate>
                                <asp:DropDownList ID="dlKostenplaats" runat="server" Width="100%">
                                    <asp:ListItem Text="Werkplaats"></asp:ListItem>
                                    <asp:ListItem Text="Verkoop"></asp:ListItem>
                                </asp:DropDownList>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>

    </ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btnOnderdelenLosToevoegen" runat="server" OnClick="btnOnderdelenLosToevoegen_click" style="display:none;"/>

我不明白这个问题是什么。 提前谢谢。

0 个答案:

没有答案