Archive for the ‘Programming’ Category

Getting the REAL Module Settings!

Strangely – since we upgraded our directory websites (such as http://www.foremosthunting.com and http://www.foremostbrewing.com) to the newest DotNetNuke version (5.02.01) our custom site map wasn’t working anymore.  I am using theiFinity.DNN.GoogleSiteMapProvider – a wonderful FREE provider – to create my site maps dynamically.

Within my directory module – I was originally using ModuleSettings to save the settings.  As our requirements grew – I knew I needed to switch over to TabModuleSettings to store my settings.  I just now came to the realization that while most of the directory listings were showing up fine for Foremost Hunting; my homebrewers website Foremost Brewing – wasn’t showing my homebrewing related listings.

Low – and – behold – when you have a question about DotNetNuke – review the core source code and see what the Core Team did.  I followed through the PortalModuleBase and found the settings (both ModuleSettings & TabModuleSettings) were being gathered in the DotNetNuke.UI.Modules ModuleInstanceContext – which was my solution for fixing my directory module’s site map provider!

Sorting GridView in Imar.Spaanjaars article

Articls are posted here – by Imar Spaanjaars

For Sorting:

1. Create an overload of GetList that accepts the SortExpression as a String.

2. Change the ODS declaration so it contains a parameter for this new sortExpression:

[SelectParameters]
[asp:Parameter Name=”sortExpression” Type=”String” /]
[/SelectParameters]

3. Set the SortParameterName attribute of the ODS:

SortParameterName=”sortExpression”

4. Enable sorting on the GridView.

Validation Expressions – Postal Codes – US and Canada

Here’s the regular expression for US & Canada Postal Codes:
^(\d{5}(( |-)\d{4})?)|([A-Za-z]\d[A-Za-z]( |-)\d[A-Za-z]\d)$

Stipping Invalid Characters from a String

First, it’s called “stripping!” Second, to strip these characters from a string, you must use the Regex.Replace method. — as denoted by microsoft here.

using System.Text.RegularExpressions

Regex.Replace(strInput, @”[^\w\.@-]”, “”);

This will strinp all invalid characters EXCEPT the period, @, and hyphen.

Sorting GridView in Imar.Spaanjaars article

Articls are posted here: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416

For Sorting:

1. Create an overload of GetList that accepts the SortExpression as a String.

2. Change the ODS declaration so it contains a parameter for this new sortExpression:

[SelectParameters]
[asp:Parameter Name=”sortExpression” Type=”String” /]
[/SelectParameters]

3. Set the SortParameterName attribute of the ODS:

SortParameterName=”sortExpression”

4. Enable sorting on the GridView.