国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

Creating Custom Portal Modules

2024-07-21 02:16:39
字體:
來源:轉載
供稿:網友
--------------------------------------------------------------------------------
a portal module combines some code and ui to present specific functionality to the user (for example, a threaded discussion) or render data, graphics and text, (for example, a "sales by region" report). in addition, a portal module needs to know how to interact with the portal framework to participate in the rendering, editing, caching and roles-based security services it provides.

portal modules are implemented as standard asp.net user controls. the logic required to enable the user control to work inside the portal framework is encapsulated in a special base class: aspnetportal.portalmodulecontrol. to create a custom portal module, simply make a user control that inherits from the aspnetportal.portalmodulecontrol class.

hello world

for example, here's a simple "hello world" portal module (helloworld.ascx).  
      <%@ control inherits="aspnetportal.portalmodulecontrol" %>

    hello world!
                

  using css styles in portal modules

the portal framework includes a stylesheet called portal.css that is applied to all tabs in the portal. you can use the styles defined in portal.css to make the appearance of your custom module consistent with the built-in modules. the most commonly used style is "normal", which is applied to most text rendered by modules. here we've updated helloworld.ascx to use a style.  
      <%@ control inherits="aspnetportal.portalmodulecontrol" %>

    <span class="normal">hello world!</span>
                

  adding a title to your module

when the portal administrator adds an instance of a module to the portal, she can give it a descriptive title. if you want your module to display it's title like the standard portal modules, add the portalmoduletitle user control to your module. the portalmoduletitle user control knows how to get the module's title from the portal framework, and render it consistently with the rest of the portal.


      <%@ control inherits="aspnetportal.portalmodulecontrol" %>
    <%@ register tagprefix="portal" tagname="title" src="../../portalmoduletitle.ascx" %>

    <portal:title runat="server" />
    <span class="normal">hello world!</span>
                

  adding support for an edit page

if your module has an edit page, you can also use the portalmoduletitle to render the edit item link next to the module's title. edittext is the text to display in the link, and editurl is the path of the edit page, relative to the portal's root directory.


      <%@ control inherits="aspnetportal.portalmodulecontrol" %>
    <%@ register tagprefix="portal" tagname="title" src="../../portalmoduletitle.ascx" %>

    <portal:title edittext="edit" editurl="portalmodules/helloworld/edithello.aspx" runat="server" />
    <span class="normal">hello world!</span>
                

  creating a module that uses data

many portal modules display data from a database or xml file as a part of their rendered output. to display data, you load and bind it just as you would for a regular asp.net user control. here's a typical example using the northwind sql database.


      <%@ control inherits="aspnetportal.portalmodulecontrol" %>
    <%@ import namespace="system.data" %>
    <%@ import namespace="system.data.sql" %>
    <%@ register tagprefix="portal" tagname="title" src="portalmoduletitle.ascx" %>

    <script language="vb" runat="server">

        sub page_load(sender as object, e as eventargs)

            dim connection as new sqlconnection("server=localhost;uid=sa;pwd=;database=northwind")
            dim command as new sqldatasetcommand("select top 10 productname,
                unitprice from products order by unitprice desc", connection)

            dim dataset as new dataset()
            command.filldataset(dataset, "products")

            grid1.datasource = dataset.tables(0).defaultview
            grid1.databind()

        end sub

    </script>

    <portal:title runat="server" />

    <asp:datagrid id=grid1
        autogeneratecolumns="false"
        cssclass="normal"
        showheader="false"
        borderwidth="0"
        runat="server">

        <property name="columns">
            <asp:boundcolumn datafield="productname" />
            <asp:boundcolumn datafield="unitprice" dataformatstring="{0:c}" />
        </property>

    </asp:datagrid>
                

  

adding a custom module to the admin tool
--------------------------------------------------------------------------------
to add a module to the admin tool, you simply create an entry for it in the <moduledefinitions> section of the portal.config file. (you'll need to edit the file directly; there's is no support for modifying this part of the configuration file in the admin tool itself.)

for example:
        <moduledefinitions>
            <moduledefinition name="helloworld" src="portalmodules/helloworld/helloworld.ascx"/>
        </moduledefinitions>
                

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 闽清县| 驻马店市| 嵊州市| 敦煌市| 河北区| 宽甸| 岑溪市| 南京市| 确山县| 镇康县| 德惠市| 高淳县| 邮箱| 体育| 道孚县| 宜阳县| 新蔡县| 托克逊县| 获嘉县| 海兴县| 临澧县| 高雄市| 介休市| 齐河县| 荥阳市| 伊川县| 蒙阴县| 如皋市| 奉新县| 霞浦县| 长汀县| 闽侯县| 准格尔旗| 桐庐县| 湟源县| 夹江县| 张家口市| 阜南县| 昌乐县| 搜索| 东港市|