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

ASP.NET入門教程 12.8 綜合整理[2]

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

    ()再次將命名空間從tempuriorg改為wroxunitednet即<WebService(Namespace:=http://wwwwroxunitednet/)>

    ()保存這個文件

    ()現在需要創建可以利用這個Web服務的頁面創建稱為LeagueViewascx的新Web用戶控件並且向其添加一個GridView控件在設計視圖中雙擊

 

Partial Class LeagueView

    Inherits SystemWebUIUserControl

 

    Protected Sub Page_Load(ByVal sender As Object ByVal e As SystemEventArgs) Handles MeLoad

 

        Dim wsConvert As New LeagueMiniView

        gridviewdatasource = wsConvertViewLeague

        GridViewDataBind()

 

    End Sub

End Class


 

    ()保存該頁面現在通過調整該頁面的代碼如下可以向defaultaspx添加這個控件

 

<%@ Register Src=LeagueViewascx TagName=LeagueView TagPrefix=uc %>

<%@ Register TagPrefix=wu TagName=News Src=Newsascx %>

 

<asp:Content ID=Content ContentPlaceHolderID=mainContent Runat=server>

 

               

    <h>Welcome to the Wrox United Web site</h>

    <p>Were a great football team No really we are Dont take any notice

    of our past performance Were just unlucky</p>

 

    <uc:LeagueView ID=miniview runat=server />

    <wu:news id=News runat=server ItemsToShow=></wu:news>

 

</asp:Content>
 

    ()現在轉到defaultaspx並查看它

[]  []  []  []  []  []  


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