Step 1. Download and install MSChart.exe from :
http://www.microsoft.com/download/en/details.aspx?id=14422
Step2.Add following lines to web.config
<handlers>
...
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<assemblies>
....
<add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<controls>
....
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<httpHandlers>
...
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
Tuesday, April 24, 2012
dotnetnuke charts
Monday, April 16, 2012
dotnetnuke ajax example
1.Here we have two related drop down and when on selected , secod one will be repopulated with related values , here is javascript part of the code placed directly into ascx control.
2.Create jsonhub page for making ajax calls from different pages
3.Ad ajax calls inside of control:
<script type="text/javascript"> function PageMethod(fn, paramArray, successFn, errorFn) { //Create list of parameters in the form: //{"paramName1":"paramValue1","paramName2":"paramValue2"} var paramList = ''; if (paramArray.length > 0) { for (var i = 0; i < paramArray.length; i += 2) { if (paramList.length > 0) paramList += ','; paramList += '"' + paramArray[i] + '":"' + paramArray[i + 1] + '"'; } } paramList = '{' + paramList + '}'; //Call the page method $.ajax({ type: "POST", url: fn, contentType: "application/json; charset=utf-8", data: paramList, dataType: "json", success: successFn, error: errorFn }) ; } var TargetDD=''; function Repopulate(value, TargetDDId, url2call) { TargetDD = TargetDDId; PageMethod(url2call, ["Group", "" + value], AjaxSucceeded, AjaxFailed); //No parameters } function AjaxSucceeded(result) { //alert(result.d[0].FirstName); var elem = document.getElementById(TargetDD); $(elem).empty(); $.each(result.d, function (index, v1) { $(elem).append( $('<option></option>').val(v1.MembershipNumber).html(v1.FirstName + " " + v1.LastName) ); }); } function AjaxFailed(result) { alert("ajax failed" + result.d); } </script>
2.Create jsonhub page for making ajax calls from different pages
Imports DotNetNuke.Modules.MembershipModule Imports System.Web.Services Namespace NEvoWeb.Modules.NB_Store Public Class jsonhub Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub <WebMethod()> Public Shared Function MSearchVolunteersbyGroup(Group As Integer) As ArrayList Dim c As New MembershipModuleController Return c.MSearchVolunteersbyGroup(Group) End Function End Class End Namespace
3.Ad ajax calls inside of control:
Dim jscall As String = String.Format("Repopulate(this.value,'{0}','{1}');", ddlSalesRep.ClientID, Me.TemplateSourceDirectory + "/jsonhub.aspx/MSearchVolunteersbyGroup") ddlTeam.Attributes.Add("onchange", jscall)
Friday, March 16, 2012
dnn compile module
here is example of .bat file which compile dnn module from command-line:
call "c:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 msbuild MyModule.sln pause
Thursday, March 15, 2012
PopupCalendar.js
to add datapicker to text field like desribed in this post
it's required to add reference to PopupCalendar.js
it's required to add reference to PopupCalendar.js
protected void Page_Load(object sender, EventArgs e)
{
Page.ClientScript.RegisterClientScriptInclude("PopupCalendar",
ResolveUrl(
"~/js/PopupCalendar.js"));
}
Dotnetnuke Module Creator best tool for generation dotnetnuke module.
Sunday, January 8, 2012
dotnetnuke.ui.skins.skin.addmodulemessage
AddModuleMessage not working inside ajax panel,
so in order to make it work do following:
1.Add placeholder on control
<asp:PlaceHolder runat="server" id="MessagePlaceHolder" EnableViewState="false"></asp:PlaceHolder>
2.Add function to code behind:
public virtual void ShowMessage(PlaceHolder ctrl, string m, bool error = true)
{
ModuleMessage.ModuleMessageType moduleMessageType = ModuleMessage.ModuleMessageType.RedError;
if (!error)
{
moduleMessageType = ModuleMessage.ModuleMessageType.BlueInfo;
}
string msg = Localization.GetString(m, LocalResourceFile);
DotNetNuke.UI.Skins.Skin.AddModuleMessage(ctrl, msg, moduleMessageType);
}
Dotnetnuke Module Creator best tool for generation dotnetnuke module.
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.
Step2. Binding in code behind, call this function on Page_load of the control or when you showing edit panel.
Don't forget to include instruction described in this post !
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.
<tr> <td valign="top" class="SubHead" style="width: 150px"> <dnn:Label ID="plStartDate" runat="server"></dnn:Label> </td> <td> <asp:TextBox ID="txtStartDate" runat="server" Width="74px" CssClass="NormalTextBox" MaxLength="100"></asp:TextBox> <asp:Image ID="txtStartDateImage" runat="server" ImageUrl="~/Images/Calendar.png" /> </td> <td> <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> </td> </tr>
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:
Dotnetnuke Module Creator fast and effective dotnetnuke module creation.
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;
}
else
{
return objCreateStatus.ToString();
}
}
Dotnetnuke Module Creator fast and effective dotnetnuke module creation.
Subscribe to:
Posts (Atom)