Thursday, December 29, 2011

dotnetnuke datepicker

Here is example how to implement datapicker in DotNetNuke:

Step 1.Below os sample of the user control containing txtStartDate textbox and Image txtStartDateImage which is related to this textbox.
When user clicks on Image datepicker popup will appear and when user selects date this date will be entered into txtStartDate and datepicker popup will be closed.
Binding will be done in code-behind class of user control , see step 2 below.

<td valign="top" class="SubHead" style="width: 150px">
<dnn:Label ID="plStartDate" runat="server"></dnn:Label>
<asp:TextBox ID="txtStartDate" runat="server" Width="74px" CssClass="NormalTextBox" MaxLength="100"></asp:TextBox>
<asp:Image ID="txtStartDateImage" runat="server" ImageUrl="~/Images/Calendar.png" />
<asp:RequiredFieldValidator ID="rqdStartDate" runat="server" CssClass="NormalRed" ErrorMessage="<b>StartDate is required </b>" ControlToValidate="txtStartDate" resourcekey="rqdStartDate"></asp:RequiredFieldValidator>
<asp:CompareValidator id="txtStartDateCorrectDate" runat="server" Type="Date" Operator="DataTypeCheck" ControlToValidate="txtStartDate" ErrorMessage="Please enter a valid date." resourcekey="txtStartDateCorrectDate" > </asp:CompareValidator>


Step2. Binding in code behind, call this function on Page_load of the control or when you showing edit panel.
private void Bindpops()
path = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtStartDate);
txtStartDateImage.Attributes.Add("OnClick", path);

Don't forget to include instruction described in this post !

try our new Dotnetnuke Module Generator for fast module creation.

Wednesday, December 28, 2011

dnn create user programmatically

below is function that will create new user account in DotNetNuke:
private string CreateDNNUser(string UserName, string FirstName, string LastName, string Email, string Password, string Street, string City, string Region, string Country, string PostalCode, string Unit, string Telephone)
DotNetNuke.Entities.Users.UserInfo objUser = new DotNetNuke.Entities.Users.UserInfo();
objUser.AffiliateID = Null.NullInteger;
objUser.PortalID = this.PortalId;
objUser.IsSuperUser = false;

objUser.Email = Email;
objUser.FirstName = FirstName;
objUser.LastName = LastName;
objUser.Username = UserName;
objUser.DisplayName = FirstName +" " + LastName;

objUser.Membership.Approved = true;
objUser.Membership.Password = Password;
objUser.Membership.Email = Email ;
objUser.Membership.Username = UserName;
objUser.Membership.UpdatePassword = true;

objUser.Profile.Country = Country;
objUser.Profile.Street = Street;
objUser.Profile.City = City;
objUser.Profile.Region = Region;
objUser.Profile.PostalCode = PostalCode;
objUser.Profile.Unit = Unit;
objUser.Profile.Telephone = Telephone;

objUser.Profile.FirstName = FirstName;
objUser.Profile.LastName = LastName;
DotNetNuke.Security.Membership.UserCreateStatus objCreateStatus =
DotNetNuke.Entities.Users.UserController.CreateUser(ref objUser);

if (objCreateStatus == DotNetNuke.Security.Membership.UserCreateStatus.Success)
return string.Empty;
return objCreateStatus.ToString();


Dotnetnuke Module Creator fast and effective dotnetnuke module creation.

An error has occurred. error is currently unavailable

The most common error in DNN ,
to see the real error you have to run this query in dotnetnuke database.

select top 1 LogProperties from EventLog order by LogCreateDate Desc

Copy and past contant of LogProperties field to see an error.
And don't forget to select dotnetnuke database if you see Invalid object name 'EventLog'.

dotnetnuke-module-creator fast and effective dotnetnuke module creation.

Thursday, December 8, 2011

dotnetnuke sql

Dotnetnuke module creator (DMC) creates sql stored procedures for all data operations:
1.Getting data collection from selected tables.
2.Getting one particular record by primary key.
3.Saving (Insert/Update) one record (list/save/delete/get).

Generates two types of sql files:
1.Files with stored procedures that can be run immediately on server.
2.SqlDataProvider files that can be used for installation packages.