? 管理員界面 訂單管理
訂單管理分為已處理訂單管理和未處理訂單管理兩種情況
? 已處理訂單的管理( )
已處理訂單管理頁面如圖 所示
圖 ? 已處理訂單管理頁面
已處理訂單管理頁面ST_Admin_orderlistd aspx的主要HTML代碼
頁面中有壹個GridView控件 用來顯示已經處理的訂單的訂購數量 訂購者 訂購時間等信息 ST_Admin_orderlistd aspx的主要HTML代碼如程序 所示
程序 ? ST_Admin_orderlistd aspx
? <form id= Form method= post runat= server >
? <asp:GridView id= GridView runat= server Width= %
? AutoGenerateColumns= False BorderColor= #E E FF
? BorderStyle= None BorderWidth= px BackColor= White
? CellPadding=
? GridLines= Horizontal
? onrowcancelingedit= GridView _RowCancelingEdit
? onrowdeleting= GridView _RowDeleting
? onrowediting= GridView _RowEditing
? onrowupdating= GridView _RowUpdating >
? <SelectedRowStyle Font Bold= True ForeColor= #F F F
? BackColor= # A C ></SelectedRowStyle>
? <AlternatingRowStyle
? BackColor= #F F F ></AlternatingRowStyle>
? <RowStyle ForeColor= # A C C BackColor= #E E FF ></RowStyle>
? <HeaderStyle Font Bold= True ForeColor= Red
? BackColor= # A C C ></HeaderStyle>
? <FooterStyle ForeColor= # A C C
? BackColor= #B C DE ></FooterStyle>
? <Columns>
? <asp:BoundField Visible= False DataField= ST_ID
? ReadOnly= True ></asp:BoundField>
? <asp:BoundField DataField= ST_opid ReadOnly= True
? HeaderText= 產品ID ></asp:BoundField>
? <asp:BoundField DataField= ST_opnum ReadOnly= True
? HeaderText= 訂購數量 ></asp:BoundField>
? <asp:BoundField DataField= ST_ouser ReadOnly= True
? HeaderText= 訂購者 ></asp:BoundField>
? <asp:BoundField DataField= ST_otime ReadOnly= True
? HeaderText= 訂購時間 ></asp:BoundField>
? <asp:BoundField DataField= ST_isdeal HeaderText= 處理 >
? </asp:BoundField>
? <asp:CommandField ShowEditButton= True />
? <asp:ButtonField Text= 刪除
? CommandName= Delete ></asp:ButtonField>
? </Columns>
? <PagerSettings Mode= Numeric />
? </asp:GridView>
? </form>
代碼說明這段代碼又是壹個包含 個事件的GridView標準控件 其中要綁定的字段為第 ~ 行 代碼第 行針對ID字段列有壹個ReadOnly屬性 表示當前列是只讀的 即使用戶在編輯狀態下 也無法更新這壹列的數據
ST_Admin_orderlistd aspx cs的主要代碼及其解釋
當頁面加載時會運行Page_Load中的代碼 對其進行初始化 將數據綁定到控件 如程序 所示
程序 ? ST_Admin_orderlistd aspx cs
? protected void Page_Load(object sender System EventArgs e)
? {
? if (Session[ admin ] == null)
? {
? Response Redirect( ST_contraller aspx?cname=noadmin )
? }
? if(!Page IsPostBack)
? {
? string ST_strsql;
? ST_strsql = SELECT *? FROM ST_tOrder where ST_isdeal = 是 order by ST_ID desc ;
? //獲取數據集
? DataTable ST_dt = ST_database ReadTable(ST_strsql)
? GridView DataSource = ST_dt;
? //將數據綁定到控件
? GridView DataBind()
? }
? }
? 返回目錄 ASP NET項目開發指南
? 編輯推薦
? ASP NET MVC 框架揭秘
? ASP NET開發寶典
lishixinzhi/Article/program/net/201311/15926