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

ASP.NET項目開發指南:客戶信息查詢(1)[2]

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

  程序主要實現了頁面中其他條件的設置以及查詢結果的顯示

  程序  ST_CustomersManModuleascx

    …

        <TR>

            <TD class=rbodycol align=left width=% colSpan=

                height=>按方式

                <!下拉列表框>

                <asp:dropdownlist id=StatusList runat=server>

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

                    <asp:ListItem Value=>姓名</asp:ListItem>

                    <asp:ListItem Value=>身份證號</asp:ListItem>

                </asp:dropdownlist>輸入

                <asp:textbox id=InputTextBox runat=server

                    Width=px></asp:textbox><asp:button id=search

                    runat=server Text=查詢 BorderStyle=Groove>

                </asp:button></TD></TR>

        <TR class=rbody>

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

                 <!GridView控件>

            <asp:GridView id=dg_CustomersList runat=server

                Width=% PageSize=

                AutoGenerateColumns=False BorderColor=Black

                DataKeyNames=ST_CIdentityId

                    onpageindexchanging=GridView_Page >

                <AlternatingRowStyle

                    BackColor=#CCCCFF></AlternatingRowStyle>

                <HeaderStyle FontBold=True

                    BackColor=#CCCCFF></HeaderStyle>

                <Columns>

                    <asp:BoundField DataField=ST_CName

                SortExpression= HeaderText=客戶姓名></asp:BoundField>

                    <asp:BoundField DataField=ST_CIdentityId

                    HeaderText=身份證></asp:BoundField>

                    <asp:BoundField DataField=ST_CPhone HeaderText=聯系

                        電話></asp:BoundField>

                    <asp:BoundField DataField=ST_RoomId HeaderText=房間

                        號></asp:BoundField>

                    <asp:BoundField DataField=ST_BeginTime

                    HeaderText=訂房時間></asp:BoundField>

                </Columns>

                <PagerSettings Mode=NextPrevious NextPageText=下一頁

                    PreviousPageText=上一頁 />

            </asp:GridView></TD>

        </TR>

        <TR>

            <td width=% height=>&nbsp; </td>

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

             Text=全部顯示 BorderStyle=Groove

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

        </TR>

    </TABLE>

  【代碼說明】代碼第~行是一個下拉列表框要求選擇查詢條件代碼第~行是一個GridView用來顯示查詢結果代碼第~行是綁定的要顯示的字段DataField的值應該與數據表的字段對應

       返回目錄ASPNET項目開發指南

       編輯推薦

       ASPNET MVC 框架揭秘

       ASPNET開發寶典

       ASP NET開發培訓視頻教程

[]  []  


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