--------------------------------------------------------------------------------
A portal module combines some code and UI to present specific functionality to the user (for example, a threaded Discussio n) or render data, graphics and text, (for example, a "Sales by Region"). In addition, a portal module needs to know and the "interact with the" portal Framework to participate in the rendering, edit ING, 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 this inherits from the ASP Netportal.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 are applied to all tabs in the portal. You can use the styles defined into Portal.css to make the appearance of your custom module consistent with the built-in MOD Ules. The most commonly used style is "Normal", which are applied to most text rendered by modules. Here we'll ' 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 are 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 the "the" module ' s title from the Portal Framework, and render it consistent Ly with the rest of the portal.
If your module has a edit page, you can also with 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 are the path of the edit page, relative to the portal ' s root direc Tory.
Many Portal Modules display data from a database or XML file as a part of their rendered output. To display data, your load and bind it just as you would for a regular asp.net the User control. Here ' s A typical example using the Northwind SQL database.
Dim Connection as New SqlConnection ("server=localhost;uid=sa;pwd=;d atabase=northwind")
Dim command as New sqldatasetcommand ("Select Top" ProductName,
UnitPrice from the products order by UnitPrice DESC ", connection)
Dim DataSet as New DataSet ()
Command. FillDataSet (DataSet, "products")
Adding a Custom Module to the Admin Tool
--------------------------------------------------------------------------------
To add a module to the Admin Tool, your simply create an entry for it <ModuleDefinitions> section of the Porta L.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 ADM In tool itself.)
For example:
<ModuleDefinitions>
<moduledefinition name= "HelloWorld" src= "Portalmodules/helloworld/helloworld.ascx"/>
</ModuleDefinitions>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.