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

ASP.NET項目開發指南:房間經營管理頁面的搭建(1)

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

    房間經營管理

    房間經營管理頁面的搭建(

  在管理員界面中單擊房間經營管理超鏈接將進入房間經營管理頁面ST_RBusinessManaspx如圖所示

  房間經營管理頁面

  ST_RBusinessManaspx的HTML代碼

  同樣這裡只介紹控件<Module:RBussiMan id=ModuleRussiMan runat=server/>ST_RBusiManModule ascx的HTML代碼如程序所示

  程序  ST_RBusiManModuleascx

    <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=left width=% height=>

                    按房間類型

                <asp:dropdownlist id=RCategoryNameList runat=server>

                    <asp:ListItem Value=>請選擇</asp:ListItem>

                </asp:dropdownlist>狀態

                <asp:dropdownlist id=StatusList runat=server>

                    <asp:ListItem Value=>請選擇</asp:ListItem>

                    <asp:ListItem Value=>未訂</asp:ListItem>

                    <asp:ListItem Value=>已訂</asp:ListItem>

                </asp:dropdownlist><asp:button id=search runat=server

                Text=查詢 BorderStyle=Groove></asp:button></TD>

            <td></td>

        </TR>

        <TR class=rbody>

            <TD class=rbodycol align=left colSpan= height=>

            <asp:datalist id=dl_RoomsList runat=server width=%

            BorderWidth=px CellPadding= BorderColor=#CCCCFF

             DataKeyField=ST_RoomId RepeatColumns=

            RepeatDirection=Horizontal

                    CellSpacing=>

                    <SelectedItemStyle

                        BackColor=#FF></SelectedItemStyle>

                    <HeaderTemplate>

                        房間使用情況

                    </HeaderTemplate>

                    <SelectedItemTemplate>

                    <TABLE cellSpacing= cellPadding= width=%

                        border=>

                        <TR><TD width=%>

                            <DIV><B><FONT color=#ff size=>

                            <%        <asp:LinkButton

    CommandName=select Runat=server OnClick=dl_RoomsList_Select>

                            <%#Eval(ST_RoomId) %>

                            </asp:LinkButton>%>

                            </FONT></B></DIV>

                            </TD></TR><TR>

                        <TD width=%>

                        <DIV><B>類別</B><%# Eval(ST_Name) %></DIV>

                        </TD></TR>

                        <TR><TD width=%>

                            <DIV><B>空房</B>

                            <asp:Label Runat=server

                            ID=Statuslabel></asp:Label></DIV>

                        </TD></TR>

                    </TABLE>

                    </SelectedItemTemplate>

                    <AlternatingItemStyle

                    BackColor=#FF></AlternatingItemStyle>

                    <ItemStyle BorderWidth=px

            BorderColor=CornflowerBlue BackColor=#CCCCFF></ItemStyle>

                    <ItemTemplate>

                    <TABLE cellSpacing= cellPadding= width=%

                    border=>

                        <TR>

                            <TD width=%>

                            <DIV><B><FONT color=#ff size=>

                    <asp:LinkButton CommandName=select

                Runat=server ID=Linkbutton Visible=False>

                <%# Eval(ST_RoomId) %></asp:LinkButton>

               <asp:Button ID=Button Text=<%#Eval

                (ST_RoomId) %> runat=server OnClick=Button_Click />

                </FONT></B></DIV>

                            </TD></TR>

                        <TR><TD width=%>

                        <DIV><B>類別</B><%# DataBinderEval(Container

                            DataItemST_Name) %></DIV>

                        </TD></TR><TR>

                        <TD width=%>

                            <DIV><B>空房</B>

                            <asp:Label Runat=server ID=StatusLabel>

                            <%=Status%>

                            </asp:Label></DIV>

                        </TD></TR>

                    </TABLE>

                    </ItemTemplate>

                    <HeaderStyle FontBold=True ForeColor=White

                        BackColor=#CCCCFF></HeaderStyle>

                </asp:datalist></TD>

        </TR>

        <tr class=rbody>

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

            <asp:repeater id=rp_RoomDetails Runat=server>

                    <HeaderTemplate>

                    <table style=FONTWEIGHT: bolder; FONTSIZE: px;

                        COLOR: #ff cellPadding= width=%>

                    <tr>

                        <td width=%>房間號</td>

                        <td width=%>酒店業務</td>

                        <td width=%>房間類型</td>

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

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

                        <td width=%>床位(個)</td>

                       <td width=%>房間位置</td>

                   </tr>

                   </table>

                   </HeaderTemplate>

                   <ItemTemplate>

                   <table cellpadding= width=% style=FONTSIZE:

                           px; COLOR:#ff>

                       <tr>

                           <td width=%>

                           <b><font color=red>

                           <%# DataBinderEval(

                       ContainerDataItemST_RoomId)%></font></b>

                           </td>

                           <td width=%>

                           <asp:HyperLink NavigateUrl=

                   <%# Eval(ST_RoomIdST_PageBaseUrlBase

                   +/ST_RoomOrderaspx?RoomId={})%>

                   Runat=server ID=OrderLink>訂房</asp:HyperLink>

               <asp:HyperLink NavigateUrl=<%#

                   Eval(ST_RoomIdST_PageBaseUrlBase

                   +/ST_RoomCheckOutaspx?RoomId={})%>

               Runat=server ID=CheckOutLink>退房</asp:HyperLink>

                       </td><td width=%><%# Eval(ST_Name)%>

                       </td><td width=%><%# Eval(ST_Area)%>

                       </td>

                       <td width=%><%# Eval(ST_Price)%>

                       </td>

                       <td width=%><%# Eval(ST_BedNum)%>

                       </td>

                       <td width=%><%# Eval(ST_RPosition)%>

                       </td></tr>

                   </table>

                   </ItemTemplate>

                   <SeparatorTemplate>

                       <table cellpadding= width=%>

                       <tr>

                       <td colspan= height= bgcolor=#ff></td>

                       </tr></table>

                   </SeparatorTemplate>

                   <FooterTemplate>

                       <table cellpadding= width=%>

                       <tr>

                       <td colspan= height= bgcolor=#ff></td>

                       </tr></table>

                   </FooterTemplate>

               </asp:repeater></td>

       </tr>

       <TR>

           <td width=% height=>&nbsp;

           </td>

           <TD align=left><asp:button id=ShowAll runat=server

               Text=全部顯示 BorderStyle=Groove

               Visible=False></asp:button></TD></TR>

   </TABLE>

  【代碼說明】上述代碼使用了datalist控件和repeater控件這和之前的代碼有所不同前面使用的都是GridView控件這兩個控件的好處是可以使用自定義的模板方便設計界面行代碼中的<%# Eval(ST_RoomId) %>是一個綁定字段的表示形式其中ST_RoomId是一個數據表中的字段行代碼中的<%=Status%>表示這是一個服務器端的變量

  注意NavigateUrl是Web控件HyperLink的屬性用來指明導航目的地

       返回目錄ASPNET項目開發指南

       編輯推薦

       ASPNET MVC 框架揭秘

       ASPNET開發寶典

       ASP NET開發培訓視頻教程


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