Getting Started

This tutorial shows how to create a simple ASP.NET Web application project using the DocumentViewer component.

The source code for this simple example is located in the following directories:

Language Project Location
C# %USERPROFILE%\Documents\TX Text Control 24.0.NET Server for ASP.NET\Samples\ASP.NET\CSharp\Documentation Tutorials\DocumentViewer\
VB.NET %USERPROFILE%\Documents\TX Text Control 24.0.NET Server for ASP.NET\Samples\ASP.NET\VB.NET\Documentation Tutorials\DocumentViewer\

Used TX Text Control classes:

Create your application

1. Open Visual Studio and create a new ASP.NET Empty Web Application.

In the opened dialog Add New Item, select Web Form and confirm with Add.

2. In the Solution Explorer, select the newly created Web Form and choose Designer from the View main menu.

Find the DocumentController component in the Toolbox and drag and drop an instance onto the Designer form.

Repeat the same with an instance of the ServerTextControl component.

3. Select the DocumentController and find the TextComponent property in the Properties Window. Set the property value to serverTextControl1 - the name of the created ServerTextControl instance.

4. In the Solution Explorer, select the newly created Web Form and choose Designer from the View main menu.

Find the DocumentViewer component in the Toolbox and drag and drop an instance onto the form.

5. While the project is selected in the Solution Explorer, choose Add Existing Item... from the Project main menu.

In the opened dialog Add Existing Item, browse to the following sample folder:

%USERPROFILE%\Documents\TX Text Control 24.0.NET Server for ASP.NET\Samples\ASP.NET\CSharp\Documentation Tutorials\DocumentViewer\

or

%USERPROFILE%\Documents\TX Text Control 24.0.NET Server for ASP.NET\Samples\ASP.NET\VB.NET\Documentation Tutorials\DocumentViewer\

Select the following file: demo.rtf and click the Add button.

6. Switch to Code view using the Code menu item of the View main menu.

Add the following code to the Form_Load event:

[C#]
protected void Page_Load(object sender, EventArgs e)
{
  InitializeComponent();
  DocumentViewer1.DocumentController = documentController1;
  DocumentViewer1.LoadDocument(Server.MapPath("Demo.rtf"));
}
[Visual Basic]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  InitializeComponent()
  DocumentViewer1.DocumentController = documentController1
  DocumentViewer1.LoadDocument(Server.MapPath("Demo.rtf"))
End Sub

Compile and start the application.