Pages

Sunday, July 26, 2009

Free cross-browser WYSIWYG editor

Finally, a free cross-browser WYSIWYG editor that's packed with every rich-text editing feature you need to make your content management system that much better.

Setting up open WYSIWYG is so easy, you can quickly turn any textarea into a powerful WYSIWYG editor with just a few simple lines of code.

Packed with every rich text editing feature you need, open WYSIWYG gives you total control over formatting your text. The ultimate textarea replacement for your content management system.

Click here for details .......

Monday, July 20, 2009

How to create PDF document using PDFDoc Scout library in ASP.NET

This page contains step by step tutorial how to create PDF document in ASP.NET using PDFDoc Scout library.

IMPORTANT NOTE: To use PDFDoc Scout library on web-server you have to have additional "Web License"
PDFDoc Scout library is capable of generating of in-memory PDF files so file needn't to be stored as a file on hard drive and can be streamed right into the browser window.
There is a special "GenerateInMemoryFile" property for such purposes. Set this property to TRUE and the library will generate and keep your PDF as in-memory stream without using of any temporary files.
1) Install PDFDoc Scout library on your computer and run Visual Studio.NET
2) Go to File menu and select New Project:
New project menu
Select ASP.NET Web Application project type and click OK
ASP.NET new project wizard
3) Visual Studio.NET will create new empty ASP.NET project. Double-click on the empty space of the form:
New blank project generated by ASP.NET
This will open source code editor window on procedure handling Page_Load event. We will place our code for PDF PDF animation generation into this procedure:
Page load handler procedure generated by ASP.NET IDE
4) Use the following code for procedure (you can simply copy and paste this code from this page into ASP.NET source code editor window):

'Put user code to initialize the page here
Dim PDFDoc
Dim Size As Long
Dim MemoryImage As System.Array
' create new PDFDoc object
PDFDoc = CreateObject("PDFDocScout.PDFDocument")
' initalize library
PDFDoc.InitLibrary("demo", "demo")
' set in-memory mode
PDFDoc.GenerateInMemoryFile = true ' set to True to generate PDF document in memory without any files on disk to output it to end-user to browser
' starts PDF document generation
PDFDoc.BeginDocument ' start PDF document generation

' add text to current page
PDFDoc.Page.AddText "Hello, World!", 100, 100, 15

PDFDoc.EndDocument ' close PDF document generation

' get size of generated in-memory PDF document
Size = PDFDoc.BinaryImageSize
' create new buffer with size equal to generated pdf document file
Dim Buffer(CInt(Size)) As Byte
' get in-memory pdf file as byte stream
MemoryImage = PDFDoc.BinaryImage
' copy byte stream into buffer
Array.Copy(MemoryImage, Buffer, Size)
' clear http output
Response.Clear()
' set the content type to PDF
Response.ContentType = "application/pdf"
' add content type header
Response.AddHeader("Content-Type", "application/pdf")
' set the content disposition
Response.AddHeader("Content-Disposition", "inline;filename=helloworld.pdf")
' write the buffer with pdf file to the output
Response.BinaryWrite(Buffer)
Response.End()
' set library object instance to Nothing
PDFDoc = Nothing

5) Now run ASP.NET project using Debug | Start command:
Start project menu
Visual Studio.NET will run ASP.NET project on web-server and you will see Internet Explorer window with generated PDF document:
PDF document generated by ASP.NET application
Click here to download the source code of this example.

Wednesday, July 15, 2009

Dynamically create ASP.NET user control using ASP.NET Ajax and Web Service

This article will explain how to load ASP.NET user control dynamically using ASP.NET AJAX and Web Service. In next post we will explain the same thing using JQuery.

Lots of user asked to mentioned examples in VB.NET, so in this article, example codes both in language C#/VB.NET

Click here for details .....

Tuesday, July 14, 2009

Color Picker ASP.NET AJAX Extender Control

I was looking for a client-side color picker control and found it extremely difficult to find something that would satisfy to my requirements. I have found plenty of pure JavaScript controls written on very different levels of proficiency and there was even one ASP.NET color-picker control that I almost liked but still my major requirement was not satisfied: I was looking for AJAX .NET Extender control - easy to use and based on a solid and proven platform.

So I have researched what other color picker controls do and decided to write the one myself that I would base on Microsoft AJAX .NET platform. After some considerations I've decided to go even further and build an AJAX Control Toolkit Extender control.

As an example I took an AJAX Control Toolkit Calendar extender and in my Color Picker extender control I also internally used another AJAX Control Toolkit control: Popup extender.

So what are the advantages of implementing a client control as an ASP.NET AJAX extender?

  1. You use ASP.NET page mark-up to render the control content to the browser.
  2. No need to manually inject JavaScript, HTML and other resources.
  3. You develop JavaScript code in a standalone file leveraging ASP.NET AJAX framework and Visual Studio intellisense abilities.
  4. JavaScript per se is very well structured, easy to read and debug.
  5. Many of the hassles of JavaScript client coding such as cross-browser compatibility, event handling, asynchronous calls are taken care of by ASP.NET AJAX framework.

So I have spent a few days coding the control and finally it's out there. I have created a Codeplex project for it so if you are interested just go there and download the control and a Demo Web site.

Now just a few more words about the extender. First, this is how it looks:

Second, it's extremely easy to use. The extender attaches to an ASP.NET TextBox server control and to an optional button that can open a popup window and an element that samples a selected color in the background. User selects a color by clicking on a colored area. Below is a code example of using an extender on an ASP.NET page.

    <asp:TextBox ID="TextBox1" runat="server" Columns="7" MaxLength="7">asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/icon_colorpicker.gif" />
<cdt:ColorPickerExtender ID="cpe" runat="server"
TargetControlID="TextBox1"
SampleControlID="ImageButton1"
PopupButtonID="ImageButton1"
/>

Feel free to download the extender from the Codeplex, try it and post any comments or suggestions on the Codeplex project page.

Sunday, July 12, 2009

Using ASP.NET AJAX Control Extenders in VS 2008

What are ASP.NET Control Extenders?

ASP.NET Control Extenders are controls that derive from the System.Web.UI.ExtenderControl base class, and which can be used to add additional functionality (usually AJAX or JavaScript support) to existing controls already declared on a page. They enable developers to nicely encapsulate UI behavior, and make it really easy to add richer functionality to an application.

Click here for details ......

Thursday, July 9, 2009

Image processing/resizing in ASP.NET tutorial utilizing url rewrite

Image resizing is a common challenge when building web applications which I have realized when building the next version of my ASP.NET CMS. In this tutorial, I will show how to do elegant ASP.NET image resizing combined with URL rewriting in order to create flicker-like image processing API.

First step we need to create a script that resizes an image on the fly. In this case I choose to work with three different image sizes, for the simplicity of the matter.

Click here for details ......

Thursday, July 2, 2009

Making sense of ASP.Net Paths

ASP.Net includes quite a plethora of properties to retrieve path information about the current request, control and application. There's a ton of information available about paths on the Request object, some of it appearing to overlap and some of it buried several levels down, and it can be confusing to find just the right path that you are looking for.

To keep things straight I thought it'd be a good idea to summarize those options briefly along with describing some common scenarios of how they might be used.


Click here for details .......