Form and List DotNetNuke Module Tutorial
A great CMS needs to make content management easy, and DotNetNuke does just that. Whether your a team of one or a team of managers, editors, and writers, DNN gives its users a robust rich text editor and many options to create great content. For largers teams, content workflows can be put into place for permission setting and approval management.
The features of DotNetNuke, whether out of the box or with third party modules, can be extremely powerful for businesses of all sizes. User management, advertisement management, email marketing, document management, multilingual ability, blog management, and more are included to help marketing and IT teams manage their website. One of the modules which is often overlooked on many sites is the Form and List module. This module has a lot of rich functionality for defining tabular data structures as well as a complete templating system for displaying or collecting the data defined by the structure.
The first step in building out the rotator is to understand what the Form and List provides out of the box. Form and List can be broken down into four separate components that work together. There is the underlying data layer that is used for storing data definitions as well as user data. There is a user interface for managing the table definition and configuring the module options. Finally, there are options for defining how data is rendered for editing the data and for viewing the data.
The raw capabilities of form and list are great, but there are many situations where you need to be able to work with data in multiple ways. For example, displaying my data as a rotator is great for the end user viewing the data, but really doesn’t provide a great experience when I want to select a record for editing. What I really want is one view for managing data and one or more additional views for displaying the data to end users. I might present the user with a summary view of data and a detailed view of a specific data element. I also might want to display different data views on several pages on the website.
First, let’s define the display that we are trying to build. Our banner rotator will display an image, a title and a description as shown below.
For my rotator, I’ll use an unordered list to hold each slide in the rotator. My jQuery and CSS will then render this data into the rotator.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <div id="slideShow"> <div id="slider"> <ul> <li> <div class="slide"> <img src="blah.png" <div class="content"> <h2>Title</h2> <p>Description</p> </div> </div> <div class="slide"> <img src="blah.png" <div class="content"> <h2>Title</h2> <p>Description</p> </div> </div> </li> </ul> </div> </div> |
Now that we know what data elements we need, we can configure a Form and List module to allow us to enter our rotator data.
I placed this module on a separate page that has restricted access. Since I am going to create a custom view for end users, I can keep the data management UI restricted. This also means that I can create a UI for data management that is tuned for quickly reviewing and editing records. Since this is pretty standard Form and List functionality I’ll leave it as an exercise for the reader to create a data management UI that makes sense to you.
This is where the interesting part begins. In order to render a separate view for anonymous users, I need to use a different module that will allow me to retrieve the data from the Form and List module and render it in the desired format.
This script can be broken down into 3 sections. In the first section, I setup a couple of using statements so that I don’t have to use full namespace references in my code. Then I setup a couple of variables to hold the ModuleID and TabID of the Form and List module, and finally I use the UserDefinedTableController to get the data.
1 2 3 4 5 6 7 8 9 | @using System.Data @using DotNetNuke.Entities.Users @using DotNetNuke.Modules.UserDefinedTable @{ int moduleId = 387; int tabId = 62; var ds = (new UserDefinedTableController(moduleId, tabId, new UserInfo())).GetDataSet(true); } |
Once I have the dataset, it is pretty straightforward to iterate over every row and output the appropriate HTML.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <div id="slideShow"> <div id="slider"> <ul> @foreach (DataRow row in ds.Tables["Data"].Rows) { <li> <div class="slide"> @row["Image"] <div class="content"> <h2>@row["Title"]</h2> @row["Description"] </div> </div> </li> } </ul> </div> </div> |
The final section just outputs some JavaScript which I’ll use to run the rotator. Add in a few lines of CSS and we now have a working example of how we can create multiple views of our Form and List data.
1 2 3 4 5 6 7 8 9 10 11 | <script src="/portals/0/js/jquery.easySlider1.7.js" type="text/javascript"></script> <script type="text/javascript" language="javascript"> $(function(){ $("#slider") .easySlider({ auto: true, continuous: true, numeric: true }); }); </script> |
Looking for Cheap DotNetNuke 7.3 Hosting?
We always very glad to help you! After make a research to find recommended DotNetNuke hosting for your DotNetNuke site, finally we choose ASPHostPortal as a winner for this category. Their team always ready to give the best services for their customers. Before that, please feel free to read the reviews about our DotNetNuke Hosting provider recommendation.
ASPHostPortal.com is a popular hosting company, who is committed to providing the most affordable world-class Windows ASP.NET hosting solutions for customers. The only focus of ASPHostPortal.com is Windows hosting, so its DotNetNuke hosting could come with the latest and stable Windows 2012 / Windows 2008 platform and many other key features.
ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for the ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, .NET 4.5.2/ASP.NET 4.5.1, ASP.NET MVC 5.2/5.1.2, Silverlight 5 and Visual Studio Lightswitch. Click here for more information.
Why ASPHostPortal the Best and Cheap DotNetNuke Hosting?
100% Focus on Microsoft Windows ASP.NET Shared Hosting
They are specialists in
- Windows Server 2012 / 2008 Hosting
- SQL 2014 / 2012 / 2008 hosting
- ASP.NET 4.5.2 / 4.5.1 Hosting
- ASP.NET MVC 6.0 / 5.2 Hosting
- DotNetNuke 7.3 / 7 Hosting
- Silverlight 6 Hosting
- IIS 8.5 Hosting
Just one click DotNetNuke Installation
They provide one of the most comprehensive customer control panels available, Plesk Panel. With Plesk, you just need a minutes to install your DotNetNuke apps. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Their control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
99,9% Uptime Guaranteed DotNetNuke Hosting
To provide the most reliable and fastest ASP.NET service, they use 100% DELL PowerEdge web servers and hosts them in three state-of-art data centers in USA(New York), Europe(Netherland) and Asia(Singapore).
The data centers have a carefully control working environment in terms of power, cooling, connectivity, security as well as many other technologies to ensure at least 99.9% uptime. At the same time, its engineers keep making efforts in improving the infrastructure. As its customers, people could choose a data center close to their location to gain better access speed.
ASPHostPortal.com DotNetNuke Hosting is Cheap
ASPHostPortal.com DotNetNuke hosting has many different plans: For DNN shared hosting you can start with Host One Plan ($5.00/mo) or Host Two Plan ($9.00/mo), customers who sign up with minimum 1 year service can get Free Domain [coupon code=”FREEDOMAIN” /] or Double SQL Space [coupon code=”DBSQL” /] with their coupon code. This offer valid for Host Two Yearly Plan or above, plus any of the Cloud Hosting & Reseller Hosting paid yearly.
[stextbox id=”asp_net_hosting” caption=”ASPHostPortal.com is Microsoft No #1 Recommended Windows Hosting Partner”]ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for the ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, .NET 4.5.2/ASP.NET 4.5.1, ASP.NET MVC 6.0/5.2, Silverlight 5 and Visual Studio Lightswitch. Click here for more information[/stextbox]
Recommended Customers Support Team
They provide 24/7 customers support through its Email Ticketing. Although it does not support phone call and live chat, the Microsoft certificated technicians can still offer the most professional support to help their customers on ASP.NET issues effectively. Besides, customers can check ASPHostPortal.com knowledgebase and Community Forum.