熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

ASP.NET項目開發指南:購物車信息(1)

2022-06-13   來源: .NET編程 

    購物車信息(

  ST_ClassProductaspx頁面中還有一個購物車的圖片單擊後將進入ST_CartInfoaspx頁面如圖所示

  購物車信息

  ST_CartInfoaspx的主要HTML代碼

  ST_CartInfoaspx頁面中最主要的控件還是GridView它是數據展示的主控件主要代碼如程序所示

  程序  ST_CartInfoaspx

    <form id=Form method=post runat=server>

    <div align=center>

    <table id=Table height=% cellSpacing= cellPadding=

            width= border=>

        <tr>

            <td vAlign=top width=><uc:st_header id=ST_Header

                    runat=server></uc:st_header></td>

        </tr>

        <tr>

            <td style=HEIGHT: % vAlign=top width=%>

                <!GridView控件>

                <asp:GridView id=GridView runat=server

    ForeColor=Black AutoGenerateColumns=False GridLines=Horizontal

                CellPadding= BackColor=White BorderWidth=px

                BorderStyle=None BorderColor=#CCCCCC Width=%>

                <SelectedRowStyle FontBold=True ForeColor=White

                    BackColor=#CC></SelectedRowStyle>

                <HeaderStyle FontBold=True ForeColor=White

                    BackColor=#></HeaderStyle>

                <FooterStyle ForeColor=Black

                    BackColor=#CCCC></FooterStyle>

                <!>

                <Columns>

                    <!模板列>

                    <asp:TemplateField HeaderText=書名>

                        <ItemTemplate>

                            <a href=<%# ST_Product

  aspx?st_productid= +

                                Eval(ST_ProductID)%>>

                            <%# Eval(ST_ProductName)%>

                            </a>

                        </ItemTemplate>

                    </asp:TemplateField>

                    <asp:BoundField DataField=ST_Price HeaderText=市場

                        價></asp:BoundField>

                    <asp:BoundField DataField=ST_SoldPrice

                        HeaderText=優惠價></asp:BoundField>

                    <asp:TemplateField HeaderText=數量>

                        <ItemTemplate>

                            <asp:TextBox ID=txtQuantity Runat=server

                    Width= Text=<%# Eval( st_quantity )%>>

                            </asp:TextBox>

                        </ItemTemplate>

                    </asp:TemplateField>

                    <asp:TemplateField HeaderText=金額>

                        <ItemTemplate>

                            <asp:Label Runat=server ID=lblSum

    Text=<%#ConvertToSingle(Eval(st_total))ToString()%>>

                            </asp:Label>

                        </ItemTemplate>

                    </asp:TemplateField>

                    <asp:BoundField Visible=False

                        DataField=ST_ProductID>

                </asp:BoundField>

                </Columns>

                <!分頁樣式>

                <PagerSettings Mode=Numeric />

  

            </asp:GridView></td>

        </tr>

        <tr>

            <td align=center><asp:button id=btnChange runat=server

    Text=更改數量 CssClass=button

    onclick=btnChange_Click></asp:button><FONT face=宋體

    >&nbsp;</FONT><asp:button id=btnNext runat=server Text=去收銀台

    CssClass=button onclick=btnNext_Click></asp:button></td>

        </tr>

        <tr>

            <td vAlign=top width=%><uc:st_bottom id=ST_Bottom

                runat=server></uc:st_bottom></td>

        </tr>

    </table>

    </div>

    </form>

  【代碼說明】代碼第~行是個復雜的GridView控件代碼第~行表示選購數量的模板列這裡之所以要用模板列是因為數量允許用戶修改所以模板列中用TextBox顯示所購數量文本框就支持用戶修改數量

       返回目錄ASPNET項目開發指南

       編輯推薦

       ASPNET MVC 框架揭秘

       ASPNET開發寶典

       ASP NET開發培訓視頻教程


From:http://tw.wingwit.com/Article/program/net/201311/15825.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.