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

用戶信息的查看、修改和刪除[2]

2022-06-13   來源: .NET編程 
    ——此文章摘自《ASPNET +SQL Server網絡應用系統開發案例精解》定價 特價 詳細>>http://tracklinktechcn/?m_id=dangdang&a_id=A&l=&l_type= width= height= border= nosave>

                                <!—模板列>
                                                            <asp:TemplateColumn HeaderText=管理權限>
                                                                     <ItemTemplate>
    <%# DataBinderEval(ContainerDataItemSTNoAdmin)ToString() ==?<font color=red>是</font>: %>
                                                                     </ItemTemplate>
    </asp:TemplateColumn>
    <!—編輯列>
                                                            <asp:EditCommandColumn ButtonType=LinkButton UpdateText=更新 CancelText =取消 EditText=編輯></asp:EditCommandColumn>
                                                            <asp:ButtonColumn Text=刪除 CommandName=Delete></asp:ButtonColumn>
                                                   </Columns>
                                                   <PagerStyle NextPageText= HorizontalAlign=Right Mode=NumericPages> </PagerStyle>
                                         </asp:datagrid></FONT></TD>
             </TR>
    </TABLE>
    <uc:stfooter id=STFooter runat=server></uc:stfooter>

    .STManagerLoginaspxcs的主要代碼及其解釋

    此代碼實現了查看修改和刪除用戶的功能頁面進行初始化時通過調用BindGrid()方法從數據庫中獲取用戶信息填充DataGrid控件主要代碼如下
    private void Page_Load(object sender SystemEventArgs e)
    {
             if(Session[STNickName] != null)
             {
                       //獲得數據庫連接字符串
                       string STconnection = ConfigurationSettingsAppSettings[strconnection];
                       STconn = new SqlConnection(STconnection);
                       if(!IsPostBack)
                       {
                                //自定義BindGrid ()方法加載用戶的信息
                                BindGrid();
                       }
             }
             else
             {
                       //重定向到首頁

right>[http://developcsaicn/dotnet_ASP/htm>]  []  [http://developcsaicn/dotnet_ASP/htm>]  [http://developcsaicn/dotnet_ASP/htm>]  [http://developcsaicn/dotnet_ASP/htm>]  


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