Entries Tagged as 'dnn'

Import module definition blank page error solution DotNetNuke

In Dotnetnuke many time you can get a blank page on Import module definition.For one of my dnn(dot net nuke) site i did Host=>Module definition=>Import module definition and got a blank page.I did a google and found solution applied that and now making that code available here.For making this thing to work you ned to get few SQL commands run from host sql window.

So, the solution is to run SQL script with Run as Script option, in Host > SQL :

So, the solution is to run SQL script with Run as Script option, in Host > SQL :

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'{databaseOwner}[{objectQualifier}GetUserRoles]‘) AND OBJECTPROPERTY(id, N’IsPROCEDURE’) = 1)
DROP PROCEDURE {databaseOwner}{objectQualifier}GetUserRoles
GO


CREATE PROCEDURE {databaseOwner}{objectQualifier}GetUserRoles
@PortalId int,
@UserId int
AS
SELECT
R.*,
UR.UserRoleID,
U.UserID,
U.DisplayName,
U.Email,
UR.EffectiveDate,
UR.ExpiryDate,
UR.IsTrialUsed
FROM {databaseOwner}{objectQualifier}UserRoles UR
INNER JOIN {databaseOwner}{objectQualifier}Users U ON UR.UserID = U.UserID
INNER JOIN {databaseOwner}{objectQualifier}Roles R ON UR.RoleID = R.RoleID
WHERE
U.UserID = @UserId AND R.PortalID = @PortalId

GO

declare @ModuleDefID int

select @ModuleDefID = ModuleDefID
from {databaseOwner}{objectQualifier}ModuleDefinitions
where FriendlyName = 'Module Definitions'
IF NOT EXISTS (SELECT ModuleControlID FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ModuleDefID = @ModuleDefID AND ControlKey = N'Import')
BEGIN
insert into {databaseOwner}{objectQualifier}ModuleControls ( ModuleDefID, ControlKey, ControlTitle, ControlSrc, IconFile, ControlType, ViewOrder, HelpUrl, SupportsPartialRendering )
values ( @ModuleDefID, 'Import', 'Import Module Definition', 'Admin/ModuleDefinitions/ImportModuleDefinition.ascx', NULL, 3, NULL, NULL, 0 )
END


SQL Server commands dot net nuke Getting table structure procedure

There are manby things which are considered as basics in dot net nuke.When you are using host sql window from dnn then most definitely you will need to have ideas of basic sql statements to fetch info from db.Few of them are:-

Listing all tables from DataBase:-

SELECT * FROM information_schema.Tables

Get Stored procedure description and Structure:-

select * from information_schema.routines where routine_name = ‘Stored Procedure Name’

Querry to fetch all tables in a database:

select * from sysobjects where type=’u’

Querry to fetch all procedures in a database:

select * from sysobjects where type=’p’

Display Table Creation And Owner info

sp_help table_name

Display Table structure and columns:-

sp_columns @table_name = ‘table_name

this will show all fields from table table_name including data type and length information.

Return a list of objects that can be queried in the current environment
EXEC sp_tables
Return information about the syscolumns table in the Company database
EXEC sp_tables syscolumns, dbo, Company, "'SYSTEM TABLE'"

Altering/modifying cloumn Width :-
alter table table_name ALTER COLUMN column_name varchar(30)

Getting Started with DNN-Creating first DotnetNuke module(DNN custom module)

What do you need to do to create a Simple first DotNetNuke (DNN) module?(contact form)

  1. Set up your development environment
  2. Under DesktopModules create a folder called contactme
  3. Create three files under contactme folder
    • contactme.dnn
    • Viewcontactme.ascx
    • Viewcontactme.ascx.cs
  4. Code for Contactme.dnn:-
    <dotnetnuke version=”3.0″ type=”Module”>
    <folders>
    <folder>
    <name>Phinest.contactme</name>
    <friendlyname>contactme</friendlyname>
    <foldername>Phinest.contactme</foldername>
    <modulename>Phinest.contactme</modulename>
    <description>A contactme module</description>
    <version>01.00.00</version>
    <businesscontrollerclass>Phinest.Modules.contactme.contactmeController</businesscontrollerclass>
    <modules>
    <module>
    <friendlyname>contactme</friendlyname>
    <cachetime>60</cachetime>
    <controls>
    <control>
    <src>DesktopModules/contactme/Viewcontactme.ascx</src>
    <type>View</type>
    <helpurl></helpurl>
    </control>
    </controls>
    </module>
    </modules>
    <files>
    <file>
    <name>Viewcontactme.ascx</name>
    </file>
    <file>
    <name>Viewcontactme.ascx.cs</name>
    </file>
    </files>
    </folder>
    </folders>
    </dotnetnuke>
  5. Code for contactme.aspx<%@ Control language=”C#” Inherits=”Phinest.Modules.contactme.Viewcontactme” CodeFile=”Viewcontactme.ascx.cs” AutoEventWireup=”true” Explicit=”True”%>

    Form here

  6. Code for contactme.aspx.csusing System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Reflection;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace Phinest.Modules.contactme
    {
    partial class Viewcontactme : PortalModuleBase, IActionable
    {
    private string strTemplate;
    protected void Page_Load(System.Object sender, System.EventArgs e)
    {
    try
    {
    if (!Page.IsPostBack)
    {
    }
    }
    catch (Exception exc) //Module failed to load
    {
    Exceptions.ProcessModuleLoadException(this, exc);
    }

    }
    }
    }