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

ASP.NET項目開發指南:用戶管理

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

    管理員界面用戶管理

    用戶管理

  用戶管理只有一個頁面如圖所示

  用戶管理頁面

  ST_Admin_usermanaspx的主要HTML代碼如程序所示代碼中的GridView控件用來對用戶信息進行查看修改和刪除操作

  程序  ST_Admin_usermanaspx

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

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

        AutoGenerateColumns=False BorderColor=#EEFF

        BorderStyle=None BorderWidth=px BackColor=White

        DataKeyNames=ST_ID

        CellPadding= GridLines=Horizontal

        onrowcancelingedit=GridView_RowCancelingEdit

        onrowdeleting=GridView_RowDeleting

        onrowediting=GridView_RowEditing

        onrowupdating=GridView_RowUpdating>

            <SelectedRowStyle FontBold=True ForeColor=#FFF

                BackColor=#AC></SelectedRowStyle>

            <AlternatingRowStyle

                BackColor=#FFF></AlternatingRowStyle>

            <RowStyle ForeColor=#ACC BackColor=#EEFF></RowStyle>

            <HeaderStyle FontBold=True ForeColor=Red

                BackColor=#ACC></HeaderStyle>

            <FooterStyle ForeColor=#ACC

                BackColor=#BCDE></FooterStyle>

            <Columns>

                <asp:BoundField  DataField=ST_ID ReadOnly=True

                    HeaderText=ID></asp:BoundField>

                <asp:BoundField DataField=ST_username HeaderText=用戶名>

                    </asp:BoundField>

                <asp:BoundField DataField=ST_userpassword HeaderText=

                    密碼></asp:BoundField>

                <asp:BoundField DataField=ST_userrname ReadOnly=True

                    HeaderText=真名></asp:BoundField>

                <asp:BoundField DataField=ST_usertel ReadOnly=True

                    HeaderText=電話></asp:BoundField>

                <asp:BoundField DataField=ST_useraddr ReadOnly=True

                    HeaderText=地址></asp:BoundField>

                <asp:BoundField DataField=ST_userclass HeaderText=權限>

                    </asp:BoundField>

                <asp:CommandField ShowEditButton=True />

                <asp:ButtonField Text=刪除

                    CommandName=Delete></asp:ButtonField>

            </Columns>

            <PagerSettings Mode=Numeric />

        </asp:GridView>

    </form>

  【代碼說明】代碼第行是當前GridView控件的主鍵標識代碼第~行是用戶操作GridView控件時觸發的控件包括更新取消更新編輯和刪除個事件代碼第~行是綁定在GridView上要顯示的列代碼第~行是一個刪除按鈕(注意其CommandName屬性如果設置為Delete則當用戶單擊此按鈕時自動觸發GridView的onrowdeleting事件)

       返回目錄ASPNET項目開發指南

       編輯推薦

       ASPNET MVC 框架揭秘

       ASPNET開發寶典

       ASP NET開發培訓視頻教程


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