HomeProductsSupportDownloadsOnline StoreOnLine DocumentationLicensingAbout UsContact Us

Need technical support or assistance?

Click Here.

Please remember to read our guidelines first.

 

 

You will receive advance information about products and web updates as well as free software and source code that we will soon make available.

Subscribe Now

Once your subscription is activated you will receive instructions on how to leave the list.

 
     
Hundreds of free Visual Basic source code snippets, activeX controls, tutorials, tips, projects and articles covering VB.NET and VB6! Great code on topics like MAPI, winsock programming, COM, MTS, XML, graphics, threading, timers, networking, API's and more!
Welcome to the largest single directory of ASP.NET resources. This free directory links to examples, articles, and tutorials. A searchable code library allows you to find scripts. A daily newsletter keeps you up to date on the latest submissions.
Search the best developer Web sites and hundreds of developer newsgroups... updated every thirty minutes!

TN00003 - Creating a simple ASP.Net application using the ActiveGantt ASP.Net Control

Applies to:
  • ActiveGantt Scheduler Component for ASP.Net (Web Server Control - VB.Net)
Summary:

This technical note walks you through the process of creating a simple ASP.Net application using the ActiveGantt ASP.Net component in Visual Basic .Net.

Open the Visual Studio .Net IDE. Create a new ASP.Net web application. In the example we will create a new web application called WebApplication1 under the localhost web.

Open the WebForm1.aspx page, open the Toolbox and right click on the toolbox. Select Customize Toolbox.

The Customize Toolbox dialog will pop up. Select the .Net Framework Components Tab.

Click on the Browse button and look for the file AGVBA20.dll. This file should be located in C:\Inetpub\wwwroot\AGDemo\bin.

The Customize Toolbox dialog will now show the ActiveGanttVBACtl as part of its list.

The Toolbox must also now display the ActiveGanttVBACtl in its list of insertable controls.

Now you can insert the control into the WebForm1.aspx page.

Navigate to the C:\Inetpub\wwwroot\WebApplication1 folder, create a new folder called SessionTemp. This folder will have the purpose of storing temporary images used to draw the ActiveGantt control and will be mapped to the TempDir property of the ActiveGantt ASP.Net control, but first the ASPNET user must be given full control over it.

Right click on the new SessionTemp folder and click on properties. Click on the Security tab.

Click on the Add button. Select the ASPNET user click on the Add button and then click the OK button.

Grant the aspnet account full Control.

Go back to the Visual Studio IDE and select the ActiveGantt control in the WebForm1.aspx page. In properties look for the TempDir property and set this value to SessionTemp.

Switch to codeview in the WebForm1.aspx page and include the following code:


   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
   Handles MyBase.Load
        If Me.IsPostBack = False Then
            mp_LoadControlData()
            ActiveGanttVBACtl1.Draw()
        Else
            mp_LoadControlData()
            ActiveGanttVBACtl1.Calculate()
        End If
    End Sub

    Private Sub mp_LoadControlData()
        ActiveGanttVBACtl1.Rows.Add("K1")
    End Sub

    Private Sub ActiveGanttVBACtl1_Click(ByVal sender As Object, _
    ByVal e As System.Web.UI.ImageClickEventArgs) _
    Handles ActiveGanttVBACtl1.Click
        ActiveGanttVBACtl1.Draw()
    End Sub

The sequence of the code must be identical to the one displayed above for any ASP.Net page that contains an ActiveGantt control. Draw and Calculate instructions must be present in the Page_Load event (Draw when the page is being visited by a user for the first time and calculate on subsequent postbacks). A Draw instruction must also be present in the Click event. Failure to include these instructions in this exact sequence will cause unpredictable control behaviour. We also generally include a subroutine called mp_LoadControlData were the control is drawn independent of whether it’s a postback operation or not.

When building this example a control with one Row object will show up on your browser:

Another very important programming task is to clean off the images that have been stored in SessionTemp when user sessions have expired. The following code in global.asax will accomplish this:


    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        If Dir(Me.Server.MapPath("SessionTemp") & "\S" & Me.Session.SessionID & "*.png") <> "" Then
            Kill(Me.Server.MapPath("SessionTemp") & "\S" & Me.Session.SessionID & "*.png")
        End If
    End Sub

Every temporary image that is stored in the TempDir Directory has a basic filename structure of S + the session ID + a date/time stamp and the extension .png. Some users prefer to have one single TempDir for all of their controls within one ASP.Net application and they use the GUID property setting which is also appended to the file names.

Home | Products | Support | Downloads | OnLine Store

Online Documentation | Licensing | About Us | Contact Us

Privacy Terms of use Copyright (c)2002-2004 Source Code Store. All trademarks are property of their legal owner.