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

ASP.NET項目開發指南:房間類型的添加(1)

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

    房間類型的添加(

  在房間類型管理頁面中單擊添加新房間類型超鏈接將打開ST_RCategoryAddaspx頁面可以在其中添加房間類型如圖所示

  添加客房類型信息頁面

  ST_RCategoryAddaspx的HTML代碼

  頁面構架和前面的基本一樣只有<MODULE:RCategoryAdd id=ModuleRCategoryAddrunat=server> </MODULE:RCategoryAdd>不同其HTML代碼如程序所示

  程序  ST_RCategoryAddaspx

    <table cellSpacing= cellPadding= width=%>

        <tr class=rheader>

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

                添加客房類型信息

            </td>

        </tr>

        <! SPACER ROW >

        <tr class=rbody>

            <td class=rbodycol align=center height=

                colspan=>&nbsp;

            </td>

        </tr>

        <tr class=rbody>

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

                <P><asp:label id=CreateLabel enableViewState=false

                runat=server 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:textbox id=RCatgNameTextBox

                            enableViewState=false runat=server

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

                            <asp:requiredfieldvalidator

                        id=RequiredFieldValidator runat=server

                        controlToValidate=RCatgNameTextBox

                                errormessage=類型名稱必須填寫

                    display=dynamic>*</asp:requiredfieldvalidator>

                            <asp:customvalidator

                        id=IdUniqueCustomValidator runat=server

                        ErrorMessage=該類型已存在

                        ControlToValidate=RCatgNameTextBox

                                OnServerValidate=IsNameValidate>*

                    </asp:customvalidator></td>

                    </tr>

                    <tr>

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

                        </td>

                        <td><asp:textbox id=AreaTextBox

                    enableViewState=false runat=server

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

                            <asp:requiredfieldvalidator

                id=RequiredFieldValidator runat=server

                controlToValidate=AreaTextBox

                errormessage=房間面積必須填寫

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

                    </tr>

                    <tr style=BACKGROUNDCOLOR: #ccccff>

                        <td width=%>床位(個)

                        </td>

                        <td><asp:textbox id=BedNumTextBox

                        enableViewState=false runat=server

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

                    <asp:requiredfieldvalidator

                    id=RequiredFieldValidator runat=server

                        controlToValidate=BedNumTextBox

                    errormessage=床位必須填寫

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

                    </tr>

                    <tr>

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

                        </td>

                        <td><asp:textbox id=PriceTextBox

                    enableViewState=false runat=server

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

                    <asp:requiredfieldvalidator

                    id=RequiredFieldValidator runat=server

                    controlToValidate=PriceTextBox

                    errormessage=價格必須填寫

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

                    </tr>

                    <tr style=BACKGROUNDCOLOR: #ccccff>

                        <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>

                        <td width=%>有線電視

                        </td>

                    <td><asp:radiobuttonlist id=TvList

                        Runat=server RepeatColumns=>

                                <asp:ListItem Selected=True>有

                        </asp:ListItem>

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

                    </asp:radiobuttonlist>

            <tr>

            <td colspan=><asp:validationsummary

           id=ValidationSummary runat=server

           HeaderText=請按下面提示正確填寫></asp:validationsummary></td>

       </tr>

       <tr>

           <td width=%>&nbsp;

           </td>

           <td>

               <asp:Button id=SubmitButton text=添加

               BorderStyle=Groove

               runat=server></asp:Button>&nbsp;&nbsp;&nbsp;&nbsp;

               <asp:Button id=ReturnButton CausesValidation=False

           BorderStyle=Groove text=返回 runat=server></asp:Button>

           </td>

       </tr>

       <tr>

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

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

       </tr>

   </table>

  【代碼說明】上述代碼演示了輸入控件文本框的驗證方法這裡使用了個驗證控件requiredfieldvalidator分別對個文本框進行了必須填寫的驗證然後在第~行還通過validationsummary控件統一顯示了所有的驗證錯誤

  說明ValidationSummary控件不與任何控件進行綁定這是與其他驗證控件的區別

       返回目錄ASPNET項目開發指南

       編輯推薦

       ASPNET MVC 框架揭秘

       ASPNET開發寶典

       ASP NET開發培訓視頻教程


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