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

ASP.NET項目開發指南:房間類型的修改和刪除(1)

2013-11-13 12:28:41  來源: .NET編程 

    房間類型的修改和刪除(

  當單擊房間類型管理頁面中的刪除按鈕時將觸發GridView_Delete事件刪除對應ID的房間類型此外在該頁面中還包含詳單超鏈接單擊後可獲取被單擊行的類型ID然後傳給ST_RCategoryEditaspx頁面從中修改房間類型的信息如圖所示

  修改房間類型信息頁面

  ST_RCategoryEditaspx的HTML代碼

  該頁面上只有<Module:RCategoryEdit id=ModuleRCategoryEdit runat=server />與前面介紹的不同下面來看看其HTML代碼如程序所示

  程序  ST_RCategoryEditaspx

    <table cellSpacing= cellPadding= width=%>

        <tr class=rheader>

            <td class=rheadercol align=left colSpan= height=>

    修改房間類型信息

            </td>

        </tr>

        <! SPACER ROW >

        <tr class=rbody>

            <td class=rbodycol align=center colSpan=

    height=>&nbsp;

            </td>

        </tr>

        <tr class=rbody>

            <td class=rbodycol align=center colSpan= height=>

                <P><asp:label id=CreateLabel runat=server

    enableViewState=false Visible=True>

             修改完畢後單擊修改信息按鈕以保存房間類型修改信息

              </asp:label></P>

                <table style=BORDERRIGHT: #ccccff px solid;

                    TABLELAYOUT: auto; BORDERTOP: #ccccff px solid;

                    BORDERLEFT: #ccccff px solid;BORDERBOTTOM:

            #ccccff px solid;BORDERCOLLAPSE: collapsewidth=%>

                <tr style=BACKGROUNDCOLOR: #ccccff>

                    <td width=%>編號

                    </td>

                    <td>

                    <asp:label id=RCategoryIdLabel runat=server

                        ForeColor=Blue FontBold=True>

                    </asp:label></td>

                </tr>

                <tr>

                    <td width=%>類型名稱

                    </td>

                    <td>

                    <asp:textbox id=RCatgNameTextBox runat=server

                    enableViewState=false MaxLength=>

                    </asp:textbox>(必填)

                    <!驗證控件驗證類別名稱是否填寫>

                    <asp:requiredfieldvalidator

                id=RequiredFieldValidator runat=server

            controlToValidate=RCatgNameTextBox errormessage=類型名稱

            必須填寫display=dynamic>*</asp:requiredfieldvalidator>

                </td><tr style=BACKGROUNDCOLOR: #ccccff>

                    <td width=%>房間面積(平方米)

                    </td>

                    <td>

                    <asp:textbox id=AreaTextBox runat=server

            enableViewState=false MaxLength=></asp:textbox>(必填)

                    <asp:requiredfieldvalidator

            id=RequiredFieldValidator runat=server

        controlToValidate=AreaTextBox errormessage=房間面積必須填寫

        display=dynamic>*</asp:requiredfieldvalidator></td>

                </tr>

                <tr>

                    <td width=%>床位(個)

                    </td>

                    <td><asp:textbox id=BedNumTextBox runat=server

    enableViewState=false MaxLength=></asp:textbox>(必填)

                      <!驗證控件驗證床位是否填寫>

                    <asp:requiredfieldvalidator

                id=RequiredFieldValidator runat=server

            controlToValidate=BedNumTextBox errormessage=床位必須填寫

            display=dynamic>*</asp:requiredfieldvalidator></td>

                </tr>

                <tr style=BACKGROUNDCOLOR: #ccccff>

                    <td width=%>價格(元/日)

                    </td>

                    <td><asp:textbox id=PriceTextBox runat=server

            enableViewState=false MaxLength=></asp:textbox>(必填)

                           <!驗證控件驗證價格是否填寫>

                        <asp:requiredfieldvalidator

        id=RequiredFieldValidator runat=server

        controlToValidate=PriceTextBox errormessage=價格必須填寫

        display=dynamic>*</asp:requiredfieldvalidator></td>

                </tr>

                <tr>

                    <td width=%>空調

                    </td>

                    <td>

                      <!單選按鈕列表>

                    <asp:radiobuttonlist id=AirConditionList

                    Runat=server RepeatColumns=>

                    <!列表條>

                    <asp:ListItem Selected=True>有</asp:ListItem>

                    <asp:ListItem>無</asp:ListItem>

                    </asp:radiobuttonlist></td>

                </tr>

                <tr style=BACKGROUNDCOLOR: #ccccff>

                    <td width=%>有線電視

                    </td>

                    <td><asp:radiobuttonlist id=TvList Runat=server

                        RepeatColumns=>

                    <asp:ListItem Selected=True>有</asp:ListItem>

                    <asp:ListItem>無</asp:ListItem>

                    </asp:radiobuttonlist></td>

                </tr>

                </table>

            </td>

        </tr>

       <tr>

           <td colSpan=><asp:validationsummary

           id=ValidationSummary runat=server HeaderText=請按下面提示

           正確填寫></asp:validationsummary></td>

       </tr>

       <tr>

           <td width=%>&nbsp;

           </td>

           <td><asp:button id=Submit runat=server

               BorderStyle=Groove Text=修改信息></asp:button>&nbsp;

               <asp:hyperlink id=Return runat=server

               NavigateUrl=/ST_RCategoryManaspx>返回

       </asp:hyperlink></td></tr>

       <tr>

           <td colspan=><asp:label id=ShowMsg

               Runat=server></asp:label></td>

       </tr>

   </table>

  【代碼說明】本段代碼主要是說明輸入控件和驗證控件的使用方法代碼第~行是一個單選按鈕列表其中每一個ListItem表示列表的一項代碼第~行是一個匯總型的驗證控件就是將頁面中所有的驗證錯誤都顯示在這個控件中

  說明驗證控件都有個屬性display=dynamic表示動態顯示只有驗證失敗時才顯示出來其余情況下不顯示

       返回目錄ASPNET項目開發指南

       編輯推薦

       ASPNET MVC 框架揭秘

       ASPNET開發寶典

       ASP NET開發培訓視頻教程


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