在asp.net ListView中检索Textbox值

时间:2018-01-02 07:21:58

标签: c# asp.net listview

我在里面生成一个文本框,生成一个listview(用户订购的产品列表)。用户可以在此文本框中输入要订购的产品数量。我将此文本框的初始值设置为0.我的问题是当用户在此文本框中插入新的数量值并单击提交按钮时,它应该检索用户插入的值,但它仍然检索初始值为0.是我的代码,谁能告诉我我的代码的哪一部分不正确?

HTML页面

import re
RE_phone = re.compile("^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$")
mobile_no = ["+919712345678","9712345678","971234567","09712345678","06712345678","6712345678"]
for each in mobile_no:
    if RE_phone.match(each):
        print(each, ": Valid", each[-10:])
    else:
        print(each, ": Invalid", 0) 

背后的代码

<div class="row">


        <asp:Listview runat="server" ID="Listview1">

            <ItemTemplate>                    
                <div class="col-sm-6 col-md-4 col-lg-4" id="divRow">                                  
                <div class="wrap-listview-block">

                    <div class="listview-block-inner">
                        <div class="row">
                            <div class="col-xs-2 col-sm-3 col-md-3 col-lg-3">
                                <%--<img src="../images/img-product-gerbang-jingga.jpg">--%>
                                <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#Eval("ProductImg") %>' Width="80.02" Height="109.55"
                                                            AutoAdjustImageControlSize="false" ToolTip='<%#Eval("ProdCode", "Photo of {0}") %>'
                                                            AlternateText='<%#Eval("ProdCode", "Photo of {0}") %>' />
                            </div>
                            <div class="col-xs-10 col-sm-9 col-md-9 col-lg-9 listing-right">
                                <div class="caption">
                                    <h3>(<%#Eval("ProdCode")%>) <%#Eval("ProdName")%> </h3>




                                    <div class="btn-details">
                                        <a href="#" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modalInfo"><i class="fa fa-info-circle" aria-hidden="true"></i></a> <a href="#" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modalPromo"><i class="fa fa-gift" aria-hidden="true"></i></a> <a href="#" class="btn btn-sm btn-default"  data-toggle="modal" data-target="#modalBrochure"><i class="fa fa-file-image-o" aria-hidden="true"></i></a> <a href="#" class="btn btn-sm btn-default"  data-toggle="modal" data-target="#modalRecipe"><i class="fa fa-book" aria-hidden="true"></i></a>
                                    </div>

                                    <div class="btn-details">

                                        <form class="form-inline">

                                            <%--<select class="form-control input-sm col-xs-6">
                                                <option>Carton</option>
                                                <option>Piece</option>
                                            </select>--%>

                                            <asp:DropDownList ID="ddlQuantity" runat="server" CssClass="form-control input-sm col-xs-6">
                                                <asp:ListItem Value="1" Selected="True">Carton</asp:ListItem>
                                                <asp:ListItem Value="2">Piece</asp:ListItem> 
                                            </asp:DropDownList>

                                            <div class="input-group col-xs-6">


                                                <span class="input-group-btn">
                                                   <asp:LinkButton runat="server" CssClass="btn btn-sm btn-sub" ID="btnDown"><i class="fa fa-minus" aria-hidden="true"></i></asp:LinkButton>

                                                </span>
                                                <asp:TextBox runat="server" ID="txtQuantity" CssClass="form-control input-sm text-right" Text="0"  Width="90"></asp:TextBox>

                                                <span class="input-group-btn">

                                                   <asp:LinkButton runat="server" CssClass="btn btn-sm btn-sub" ID="btnUp"><i class="fa fa-plus" aria-hidden="true"></i></asp:LinkButton>
                                                </span>



                                                <ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender1" Runat="server" TargetControlID="txtQuantity" TargetButtonDownID="btnDown" TargetButtonUpID="btnUp"/>

                                            </div>

                                        </form> 

                                    </div>                                          

                                </div>
                            </div>
                        </div>
                    </div>

                </div><!-- listing block -->                                

            </div><!--Product block -->                
            </ItemTemplate>
        </asp:Listview>




    </div>

    <div class="footer-bar">
        <div class="row">
            <div class="col-xs-12">
                <asp:LinkButton  runat="server" ID="btnProceedOrder" OnClick="btnProceedOrder_Click" >
                    <div class="footer-inner">                          
                            <span class='glyphicon glyphicon-shopping-cart' aria-hidden="true"></span>
                            <br />
                            <asp:Literal runat="server" ID="litProceedOrder" Text="<%$ Resources:Lang, ProceedOrder %>"></asp:Literal>
                    </div>
                </asp:LinkButton>
            </div>
        </div>
    </div>

0 个答案:

没有答案