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

C#高級編程:數據綁定深入理解[2]

2022-06-13   來源: .NET編程 
    ——此文章摘自《C#高級編程(第版)》定價元 特價元 購買

    使用模板的示例

    在頁面的頂部擴展表格使之包含一個DataList顯示存儲在數據庫中的每個會議使這些會議成為可選擇的這樣單擊每個會議的名稱就可以顯示它們的信息

    修改PCSWebApp項目的WebFormaspx中的代碼
                <tr>
                   <td align=center colSpan=>
                      <asp:ValidationSummary ID=validationSummary Runat=server
                                  HeaderText=Before submitting your request:/>
                   </td>
                </tr>
                <tr>
                   <td align=left colSpan= width=%>
                      <table cellspacing=>
                         <tr>
                            <td width=% bgcolor=#ccffcc >
                               <asp:DataList Runat=server ID=eventDetails
                                           OnSelectedIndexChanged=
                                           eventDetails_SelectedIndexChanged>
                                  <ItemTemplate>
                                     <asp:LinkButton Runat=server
                                                     CommandFTEL=Select
                                                     ForeColor=#ff
                                                     ID=Linkbutton
                                                     CausesValidation=false>
                                        <%# DataBinderEval(ContainerDataItem
                                                            Name)%>
                                     </asp:LinkButton>
     
                                     <br>
                                  </ItemTemplate>
                                  <SelectedItemTemplate>
                                     <b><%# DataBinderEval(ContainerDataItem
                                                            Name) %></b>
                                     <br>
                                  </SelectedItemTemplate>
                               </asp:DataList>
                            </td>
                            <td valign=top>
                               <asp:Label Runat=server ID=edName
                                          FontFTEL=Arial FontBold=True
                                          FontItalic=True FontSize=>
                                  Select an event to view details
                               </asp:Label>
                               <br>
                               <asp:Label Runat=server ID=edDate/>
                               <br>

[]  []  []  []  


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