public string GetOrdinal(int Number)
{
if (((Number % 100) / 10) != 1)
{
if ((Number % 10) == 1)
return "st";
else if ((Number % 10) == 2)
return "nd";
else if ((Number % 10) == 3)
return "rd";
else
return "th";
}
else
return "th";
}
Source -http://www.dotnetnuke.com
Comparison of the Professional and Community Editions
The
DotNetNuke Professional Edition 5.1 is a tested and verified version of
the DotNetNuke framework that meets the requirements of organizations
running business-critical web applications. The Professional Edition
offers the same features as the Community Edition plus some additional
features specifically designed for business-critical applications. The
matrix below indicates the differences between the DotNetNuke Community
and Professional Editions.
For more information, also see:
| Feature |
Community
Edition |
Professional
Edition |
|
Google Analytics Support
Support for injection of analytics tracking code or other content in a specific location of every page
|
 |
 |
|
Google Analytics for Marketing Support
Support for advanced Google Analytics functionality such as visitor
type, landing page, role, or referrer segmentation
|
|
 |
|
Advanced Content Approval Process
Allows administrators to create custom workflows with an unlimited number of states and reviewers
|
|
 |
|
Change Audit
Last modified and full history audit trails
|
 |
 |
|
Granular Permissions
Page, module and folder level extended permissions to provide more granular security rights
|
|
 |
|
Distributed Caching Provider
More efficient resource usage in large web farms
|
|
 |
|
File Integrity Checking
Checks files in the installation and reports any inconsistencies which may impact website reliability
|
|
 |
|
Health Monitoring
Pings the website periodically to identify failures and will notify the
site owner. Also ensures the site stays in web server memory for faster
user accessibility
|
|
 |
|
Vulnerability Database
Maintains a vulnerability database for each product version to easily identify potential issues
|
|
 |
|
Comprehensive documentation and online Knowledge Base that provide guidance for DotNetNuke administrative tasks and answers to common technical questions
|
|
 |
friends...
I have been re-awarded with 2009 Microsoft® MVP Award in .NET/ASP.NET Category. This is the second consecutive year as an MVP; and it feels like allmost full moon of my career!!
The mail I received:
Dear Kaushal Parik,
Congratulations! We are pleased to present you with
the 2009 Microsoft® MVP Award! This award is given to exceptional technical
community leaders who actively share their high quality, real world expertise
with others. We appreciate your outstanding contributions in ASP/ASP.NET
technical communities during the past year.
........ long live community :)
Hi all …
This time a great news for all the technology enthusiast and want to meet
great peoples in technology and you missed TechEd India 2009 so
you can attend now the same kind of event in Ahmedabad, India on June
20, 2009 Saturday(TechEd on Road) by 1:30 PM.
You will get a chance to meet Two MVP’S here Jacob Sebastian
and Pinal Dave , who presents
numerous technical sessions on SQL Server, Exchange Server 2010, Windows Server
2008 and Virtualization.
Anyone who is interested in technology can attend this event .This is free
event no charges will be taken to attend this event. You can get detailed
information about this event on Pinal’s
Blog and Jacob’s
Blog .
So mark your calendar for this grand event in Ahmedabad here are the details
of this event ::
Location ::
Hotel Rock Regency
C.G. Road
Ahmedabad, India.
Date & Time::
June 20, 2009 Saturday
1:30 PM
Just check out microsoft.com/areyoucertifiable
a funny dummy test environment who wants to appear and test yourself for ms certification. You can create login or can play as guest, select avtar. There are more than 400 Questions (objective - options to select) with 20 episodes and 5 seasons.
lol.. i loved this :)
The default behaviour of AJAX Accordion is: you click on any Accordion pane (say; any control placed in Accorion Pane Header section) cause that pane to Expand and collapse rest of the panes other than the pane which you clicked.
It is also fairly easy to open Accordion Panes when you "MouseOver" on Pane rather than need to click the pane to open it.

All you need to add a JavaScript function to ahieve that and call it or "MouseOver" event of ImageButton / Link / or any submit control which is placed inside Accordion Pane.
You need to add below script in your page:
<script language="javascript">
function Openpane(paneIndex)
{
//MyAccordion is the ID of AJAX Accordion control
var behavior = $get("<%=MyAccordion.ClientID%>").AccordionBehavior;
behavior.set_SelectedIndex(paneIndex);
}
</script>
You need to pass the current Accordion Pane index as asrument of the above script function and call this function on "MouseOver" event as:
<Panes>
<ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">
<Header>
<a href="" class="accordionLink" onmouseover="Openpane('0')">1. Accordion</a></Header>
<Content>
The Accordion is a web control that allows you to provide multiple panes and display
them one at a time. It is like having several Panes where only one can be expanded
at a time. The Accordion is implemented as a web control that contains AccordionPane
web controls. Each AccordionPane control has a template for its Header and its Content.
We keep track of the selected pane so it stays visible across postbacks.
</Content>
</ajaxToolkit:AccordionPane>
</Panes>
for every pane, you can call the script function on "MouseOver" event by passing the index of that pane as argument.
Thats it! Hope it would be helpful for someone in same need.
I need to add Captcha Control for couple of contact and submission forms to stop
possible spam bots. I tried with the similar way I approched In previous website
application developed in ASP.NET. But, Its even too easy to add Captcha capability
in forms than we do for simple websites. DotNetNuke/DNN is having a built in Captcha
control which can be used on contact and submission forms.
First you need to add register tag for the control on your module user control.
This will allow to create Captcha control and use it in code. The register line
goes as:
<%@
Register TagPrefix="dnn"
Assembly="DotNetNuke"
Namespace="DotNetNuke.UI.WebControls"%>
Next, is you need to create the control in ascx page as:
<dnn:CaptchaControl runat="server"
ID="dnnCaptchaControl"
ErrorStyle-CssClass="NormalRed"
cssclass="Normal"
ErrorMessage="The
typed code must match the image, please try again"
CaptchaHeight="35"
CaptchaWidth="120"
/>

Believe
me, you are done with DNN Captcha control! You only need to validate whether the
entered value for captcha by user is correct or not. You can write below code in
contact/sybmission form's submit button click event:
if(ctlCaptcha.IsValid)
{
//Captcha is valid! Code to submit
the contact/submission form...
}
else
return;
This
is a mere note to remember for future rather than a blog entry. While I am working
on code to download file from server. I write below code:
{
int ChunkSize = 10000;
string sFileFullPath = Server.MapPath("New Text Document.txt");
System.IO.FileInfo toDownload = new System.IO.FileInfo(sFileFullPath);
if (System.IO.File.Exists(sFileFullPath))
{
Response.Clear();
using (FileStream iStream = System.IO.File.OpenRead(sFileFullPath))
{
long dataLengthToRead = iStream.Length;
Byte[] buffer = new Byte[dataLengthToRead];
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
while (ChunkSize > 0 && Response.IsClientConnected)
{
if (ChunkSize > dataLengthToRead)
{
ChunkSize = int.Parse(dataLengthToRead.ToString());
}
int lengthRead = iStream.Read(buffer, 0, ChunkSize);
Response.OutputStream.Write(buffer, 0, lengthRead);
Response.Flush();
dataLengthToRead = dataLengthToRead - lengthRead;
}
}
Response.Close();
Response.End();
}
else
{
this.Page.ClientScript.RegisterStartupScript(GetType(), "ShowMessage", "<script language='javascript'>alert('No Files Available');</script>");
}
}
When I ran the application I found that the file which I
need to download was containing spaces in its name like “New Text Document.txt”.
The problem is:
In FF, was truncating the filename from space while showing
the file download dialog . So, its only showing the filename as “New”
(and truncating the rest of the filename after space).

In IE, was replacing the spaces in filename with underscore
( _ ) as “New_Text_Document.txt” while showing the file download dialog
box.

This something I dont want to have. I need to have the exact
filename as it is on server.
The solution is:
For FF: you need to enclose the name of the file in Quotes
while you add it as attachment in response header as:
Response.AddHeader("Content-Disposition",
"attachment;
filename=\""
+ filename +
"\"");
For IE: you need to identify and replace the space in
filename with “%20” (something like encoding filename) as:
String userAgent = Request.Headers.Get("User-Agent");
String filename = toDownload.Name;
if (userAgent.Contains("MSIE 7.0"))
filename = toDownload.Name.Replace(" ", "%20");
Thats It! Hope it would be helpful for
someone in same need!
Complete Code would be:
{
int ChunkSize = 10000;
string sFileFullPath = Server.MapPath("New Text Document.txt");
System.IO.FileInfo toDownload =
new System.IO.FileInfo(sFileFullPath);
if (System.IO.File.Exists(sFileFullPath))
{
Response.Clear();
using (FileStream iStream = System.IO.File.OpenRead(sFileFullPath))
{
long dataLengthToRead = iStream.Length;
Byte[] buffer = new Byte[dataLengthToRead];
Response.ContentType = "application/octet-stream";
String userAgent = Request.Headers.Get("User-Agent");
String filename = toDownload.Name;
if (userAgent.Contains("MSIE 7.0"))
filename = toDownload.Name.Replace(" ", "%20");
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
while (ChunkSize > 0 && Response.IsClientConnected)
{
if (ChunkSize > dataLengthToRead)
{
ChunkSize = int.Parse(dataLengthToRead.ToString());
}
int lengthRead = iStream.Read(buffer, 0, ChunkSize);
Response.OutputStream.Write(buffer, 0, lengthRead);
Response.Flush();
dataLengthToRead = dataLengthToRead - lengthRead;
}
}
Response.Close();
Response.End();
}
else
{
this.Page.ClientScript.RegisterStartupScript(GetType(), "ShowMessage", "<script language='javascript'>alert('No Files Available');</script>");
}
}
I
am trying to validate textbox for numeric entry, while I added this
code to accomplish in page_load event:
textbox.Attributes.Add("onkeypress",
"return
(window.event.keyCode == 45 || window.event.keyCode == 13 ||
window.event.keyCode == 8 || window.event.keyCode == 9 ||
window.event.keyCode == 189 || window.event.keyCode == 109 ||
(window.event.keyCode >= 48 && window.event.keyCode <=
58) )");
It
worked fine in IE7 and IE8, but it didnt work for FF though. A bit
googling gave me conclusion that FF doest recognize
window.event.keyCode.
Basically
Firefox supports the which property instead of the keyCode property
IE does. By checking which (window.event.which)
of
them exists with an if statement we can reliably get the key that was
pressed.
I
replaced above code with:
textBox.Attributes.Add("onkeypress",
"var
key; if(window.event){ key = event.keyCode;}else if(event.which){ key
= event.which;} return (key == 45 || key == 13 || key == 8 || key ==
9 || key == 189 || (key >= 48 && key <= 58) )");
it
worked for both IE and FF. Hope
it would help someone in same need!
Here is another requirement (perhaps a common requirement!) I needed to implement
in one of on-going project website application. I needed to generate a PDF file
as output from the inputs entered by end-user in a form. On Completing the form,
end-user should be able to download a PDF file of what they have given the inputs
in the form.
I need to generate PDF file in a given format and force the download dialog to let
the user save generated PDF save on their/client machine.
I tried searching any free :) third party dlls which would help me to generate PDF
files on-the-fly. Things I tried:
[1] Tried searching almost third party tools/dlls
including
Siberix PDF Library
,
PDF Vision .Net etc etc, which are having similar functionality. But not FREE
:(
[2] Tried with
iTextSharp - Tutorial
and
PDFsharp - Download PDFsharp Version 1.20 These dlls/libraries are totally free
and really interesting to work with. All we need to do is define elements like HTML
and add those elements to PDF document object which then finally generated as PDF
document. But, this is the problem for me as I am having a huge PDF file needed
to generate as output and it would required a loot of time to code for a document
by placing line by line cells, TR and TD, Tables and background, Border colors,
images etc. and most of all is annoying Texts to be placed in those elements with
proper fonts, colors and padding/alignment.
At last after wasting time in googling and
on free tools/libraries, I got an idea to create PDF on-the-fly. I was thinking
of creating PDF files dynamically and I created it smoothly with out too much work
and code.
This is how it goes:
[1] I created a clean A4 size SnapShot of
the PDF file I needed to be generated dynamically.
[2] Next, I added a blank crystal report
to the solution.
[3] I added/set the PDF SnapShot as the background
of the crystal report by Right Click on the detail section of the crystal report
> Insert > Picture > and select the SnapShot and place it inside the detail
section with proper left-top padding.

[4] as of now, Crystal Report is showing
exactly same as the PDF file with blank inputs.
[5] next is, to accept inputs from end-user
and pass those inputs as parameters to Crystal Report.
[6 ] I declared required parameters those
are needed to pass runtime with the input values entered by end-user to Crystal
Report. And place those parameters object in the Crystal Report accurately in a
way, like those parameters were showing as the resultant values in PDF files. At
this time, Crystal Report is having PDF like look with parameters. For this I need to set the PDF SnapShot background "send to BACK" as:

Below are the declared parameters which will be passed dynamically after accepting/submitting user inputs.

This is how Crystal Report saw when Parameters placed on the Crystal Report Detailed section after moving the SnapShot to move BACK:

[7] After Declaring parameters, only thing
left is to pass values and directly export the Crystal Report in PDF file rather
than to show it on user screen. And after successful Export in PDF file, force download
dialog to let end-user save the generated PDF file.
Below is the Code to pass parameters dynamically
and force download dialog to save the file:
'create
the report document
Dim doc
As
New ReportDocument()
Dim fileName
As
String
= Server.MapPath("~/DesktopModules/OnlineForm/OnlineForm.rpt")
'load the rpt
file to document
doc.Load(fileName)
'pass the user
inputs to crystal report parameters those will sit in the output pdf file
doc.SetParameterValue("@CompanyName", txtCompany.Text.Trim())
doc.SetParameterValue("@CustomerName", txtFirstName.Text.Trim()
+
" "
+ txtLastName.Text.Trim())
doc.SetParameterValue("@Address", txtAddress.Text.Trim())
doc.SetParameterValue("@City", txtCity.Text.Trim())
doc.SetParameterValue("@Province", txtProvince.Text.Trim())
doc.SetParameterValue("@PostalCode", txtPostalCode.Text.Trim())
doc.SetParameterValue("@Phone1", txtPhone11.Text.Trim()
+
" - "
+ txtPhone12.Text.Trim() + " - " + txtPhone13.Text.Trim())
doc.SetParameterValue("@Phone2", txtPhone21.Text.Trim()
+
" - "
+ txtPhone22.Text.Trim() + " - " + txtPhone23.Text.Trim())
doc.SetParameterValue("@Phone3", txtPhone31.Text.Trim()
+
" - "
+ txtPhone32.Text.Trim() + " - " + txtPhone33.Text.Trim())
'set the export
options to PDF
Dim exportOpts
As
ExportOptions = doc.ExportOptions
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
exportOpts.DestinationOptions =
New DiskFileDestinationOptions()
' Set the disk
file options.
Dim diskOpts
As
New
DiskFileDestinationOptions()
CType(doc.ExportOptions.DestinationOptions,
DiskFileDestinationOptions).DiskFileName = Server.MapPath("~/DesktopModules/OnlineForm/OnlineForm.pdf")
'export the report
to PDF rather than displaying the report in a viewer
doc.Export()
'force download
dialog to download the PDF file at user end.
'Set the appropriate
ContentType.
Response.ContentType = "Application/pdf"
'Get the physical
path to the file.
Dim FilePath
As
String
= Server.MapPath("~/DesktopModules/OnlineForm/OnlineForm.pdf")
'Write the file
directly to the HTTP content output stream.
Response.WriteFile(FilePath)
Response.End()
Thats it!
Hope it would help anybody who need to develop similar functionality!
UPDATE:
incase, if anybody needs code in C#:
//create the report document
ReportDocument doc = new ReportDocument();
string fileName = Server.MapPath("~/DesktopModules/OnlineForm/OnlineForm.rpt");
//load the rpt file to document
doc.Load(fileName);
//pass the user inputs to crystal report parameters those will sit in the output pdf file
doc.SetParameterValue("@CompanyName", txtCompany.Text.Trim());
doc.SetParameterValue("@CustomerName", txtFirstName.Text.Trim() + " " + txtLastName.Text.Trim());
doc.SetParameterValue("@Address", txtAddress.Text.Trim());
doc.SetParameterValue("@City", txtCity.Text.Trim());
doc.SetParameterValue("@Province", txtProvince.Text.Trim());
doc.SetParameterValue("@PostalCode", txtPostalCode.Text.Trim());
doc.SetParameterValue("@Phone1", txtPhone11.Text.Trim() + " - " + txtPhone12.Text.Trim() + " - " + txtPhone13.Text.Trim());
doc.SetParameterValue("@Phone2", txtPhone21.Text.Trim() + " - " + txtPhone22.Text.Trim() + " - " + txtPhone23.Text.Trim());
doc.SetParameterValue("@Phone3", txtPhone31.Text.Trim() + " - " + txtPhone32.Text.Trim() + " - " + txtPhone33.Text.Trim());
//set the export options to PDF
ExportOptions exportOpts = doc.ExportOptions;
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
exportOpts.DestinationOptions = new DiskFileDestinationOptions();
// Set the disk file options.
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
((DiskFileDestinationOptions)doc.ExportOptions.DestinationOptions).DiskFileName = Server.MapPath("~/DesktopModules/OnlineForm/OnlineForm.pdf");
//export the report to PDF rather than displaying the report in a viewer
doc.Export();
//force download dialog to download the PDF file at user end.
//Set the appropriate ContentType.
Response.ContentType = "Application/pdf";
//Get the physical path to the file.
string FilePath = Server.MapPath("~/DesktopModules/OnlineForm/OnlineForm.pdf");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();

Core ASP.NET: This Refcard summarizes the most commonly used core functions and controls in ASP.NET
Try it! Its free but requires registration.
There are possible work-a-round and solution to work upon "session auto expire earlier" issue. Setting SessionTimeOut in web.config would no be enough to have your session persist for the said time or you want it to be.
Here I have found some solution which worked in my case:
[1] go to IIS/inetmgr > right click the website > properties
> Virtual Directory/Home Directory Tab > Click Configufation
button > Select Option Tab > Check "Enable Session State"
CheckBox and Set the Sesion Timeout Minutes you want it tobe > Apply
the changes made by clicking OK.
[2] next is, just check the
application pool under which the site is running. > goto that
application pool > right click > properties > performance tab
> check the CheckBox which is under "Idle TimeOut" Panel (first
checkbox) and set the TimeOut you want it tobe.
Hope it would help some one!!
Generally, I would like to blog post any errors that I face duing development. So that it would be helpful to me for my future reference in case I face it again as well as for the sake of any blog readers who may face same error.
Talking about the error "Invalid URI: The hostname could not be parsed error": This the same and common error I faced previously some times back and which I also stated in my blog entry DotNetNuke - Invalid URI: The hostname could not be parsed
This time I was about to run a DNN application which is configured from my local server to live application server when I faced the same error. I tried the same work-a-round which I stated in my previous blog entry. But, this time that didn't work even after investing some hrs investigation. I noticed that portal alias was not getting changed in the url when running the application. So, I tried to change the database name (in web.config connectionstring) to some arbitrary (i dont know why!!) names and ran the applicaiton again. Obviously, this will give sql server related error, as it would not found that catalog in sql server. After running the application once with wrong database name, I again changed the database name in connection string to correct name and recycled the application pool. Great!! This time it worked any anyhow. (again, I dont know, Why!!)


Cross browser compatibility struggle is getting upsetting while working with asp:Menu Server Control. Anyhow, It was not rendering/working well with Safari and Chrome.
A bit of googling... and I have a solution for this.
I have added below small piece of code snippet in my MasterPage's Page_Load event
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
{
Request.Browser.Adapters.Clear();
}
This will tell asp.net not to use an adapter when rendering the menu
control.
This will work for both Safari and chrome as well because they both use
webkit which is how asp.net identifies Safari1Plus.
More Posts
Next page »