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

ASP.NET項目開發指南:查看訂單(1)

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

    查看訂單(

  如果用戶提交表單會觸發Button_Click事件該事件會把用戶剛剛所選購的商品插入到數據庫中並提交到ST_userorderlistaspx頁面如圖所示

  訂單信息頁面

  ST_userorderlistaspx的主要HTML代碼

  此頁面中有兩個控件GridView和GridView分別用來顯示未處理的訂單和已經處理的訂單ST_userorderlistaspx的主要HTML代碼如程序所示

  程序  ST_userorderlistaspx

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

        <!頭控件>

        <uc:ST_khead id=Khead runat=server></uc:ST_khead></TD>

            <table width= border= align=center cellpadding=

        cellspacing= bgcolor=#ffffff>

                <tr bgcolor=#><td height= colspan=

            valign=top>

                <table width=% height= border= cellpadding=

            cellspacing=><tr><td

            background=images/topbannerjpg>&nbsp;</td></tr>

                </table></td></tr>

                <tr><td width= align=center valign=top>

                    <uc:ST_kuserleft id=Kuserleft

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

                    <td colspan= valign=top><table width=

                    height= border= cellpadding=

                cellspacing= bgcolor=#><tr><td height=

                bgcolor=#cc><strong><font color=#ffffff>::我的訂

                單</font></strong></td></tr><tr><td

        bgcolor=#ffffff><table width= border= cellspacing=>

                cellpadding=<tr><td>&nbsp;<FONT face=宋體><div

            align=center><strong><font color=#cc>待處理的訂單

            </font></strong></div>

        <!GridView控件>

        <asp:GridView id=GridView runat=server Width=px

            AutoGenerateColumns=False>

        <Columns>

            <asp:TemplateField>

                <HeaderTemplate>

                    <table width=% border= cellspacing=

                    cellpadding=>

                        <tr>

                            <td width=%>訂單編號</td>

                            <td width=%>訂購物品</td>

                            <td width=% align=center>訂購數量</td>

                            <td width=% align=center>訂購日期</td>

                            <td width=%>&nbsp;</td>

                            <td width=%>&nbsp;</td>

                        </tr>

                    </table>

                </HeaderTemplate>

                <ItemTemplate>

                    <table width=% border= cellspacing=

                        cellpadding=>

                        <tr>

                            <td width=%><%# Eval(ST_ID)%></td>

                            <td width=%><%#

                        Eval(ST_productname)%></td>

                            <td width=% align=center><%#

                        Eval(ST_opnum)%></td>

                            <td width=% align=center><%#

                        Eval( ST_otime)%></td>

                        </tr>

                    </table>

                </ItemTemplate>

            </asp:TemplateField>

        </Columns>

        </asp:GridView>

        </FONT></td></tr><tr><td><div align=center><strong><font

        color=#cc>已經處理的訂單

        <!GridView控件>

        <asp:GridView id=GridView runat=server Width=px

        AutoGenerateColumns=False>

            <Columns>

                <asp:TemplateField>

                    <HeaderTemplate>

                        <table width=% border= cellspacing=

                        cellpadding=>

                            <tr>

                                <td width=%>訂單編號</td>

                                <td width=%>訂購物品</td>

                                <td width=% align=center>訂購數量

                                        </td>

                                <td width=% align=center>訂購日期

                                    </td>

                            </tr>

                        </table>

                    </HeaderTemplate>

                    <ItemTemplate>

                        <table width=% border= cellspacing=

                            cellpadding=>

                            <tr>

                                <td width=%><%# Eval(ST_ID)%></td>

                                <td width=%><%#

                                        Eval( ST_productname)%></td>

                                <td width=% align=center><%#

                                        Eval(ST_opnum)%></td>

                                <td width=% align=center><%#

                                        Eval(ST_otime)%></td>

                            </tr>

                        </table>

                    </ItemTemplate>

                </asp:TemplateField>

            </Columns>

        </asp:GridView>

    </font></strong></div>

        </td></tr></table>/td></tr></table></td></tr></table>

    <uc:ST_kfoot id=Kfoot runat=server></uc:ST_kfoot>

    </form>

  【代碼說明】代碼第~行有兩個GridView個顯示待處理的訂單個顯示已經處理過的訂單將它們放在一起用戶可以方便地浏覽所有的訂單這裡所有的數據都只是展示不能進行編輯和刪除

       返回目錄ASPNET項目開發指南

       編輯推薦

       ASPNET MVC 框架揭秘

       ASPNET開發寶典

       ASP NET開發培訓視頻教程


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