Step by Step Tutorial.Creating workflows with Windows Sharepoint Services and MOSS 2007 (part 15/20).Easy ASPX Initiation Forms-(my small generic framework)


Step by Step Tutorial. Creating Workflows for Windows Sharepoint Services and MOSS2007 (part 15/20). Easy ASPX Initiation Forms-(by using my small generic framework)


By Serge Luca







  1. Download the startup project
  2. Download the startup files
  3. Download the framework code (optional)
  4. Download the final code(optional)


After the previous post, I’ve upgraded my generic framework to support Association and Initiation Forms. In this post I will illustrate how to create initiation forms.

The assembly and the main namespace have been renamed “SergeLuca.WorkflowTools.AspxForms”.

The framework now provides 2 main classes your association or initiation page must be derived from:


  • public abstract class GenericWFAssocPage<TA> : Microsoft.SharePoint.WebControls.LayoutsPageBase

(TA is the Association Data class )

  • public abstract class GenericWFInitPage<TI, TA> : Microsoft.SharePoint.WebControls.LayoutsPageBase

(TI is the Initiation Data class)

These classes make use internally of the classes :


  • WorfklowAssociationContext<TA>
  • WorkflowInitiationContext<TI, TA>


1.Use the existing project in the startup folder

This startup project is  more or less the project you build in step 14.

The main differences are :

  • My generic aspx form framework has been compiled in an assembly called SergeLuca.WorkflwTools.AspxForms which has been referenced to the project. The framework code can be downloaded here and it is an upgraded version of the one described in step 14.
  • The FromAssocDataToPage function defined in WFAssoc.aspx provides the association data directly (the context has been hidden in the library).


[Fig 1.Generic framework assembly referenced in the project]

An initiation form, WFInit.aspx, has been provided in the LAYOUTS\DemoAspxFormWorkflow folder :


[Fig 2. WFInit.aspx Initiation form provided with the project]


  • Open this file, analyze the code : this page is very similar to the association page created in the previous post except that we don’t have the radSerial and radParallel checkboxes.
  • Observe the @Page directive : the code behind will be implemented in a class named WFInit that we are going to create.

2. Add and implement the Initiation form Page : the GenericWFInitPage


  • Add a new class to the project, call it WFInit and derive this class from a class provided by my framework: GenericWFInitPage; this class takes 2 generic parameters : the class storing the Initiation Form Data which will must implement and the class storing the association form data (AssocFormData provided in the previous post).
  • Add the file InitFormData.cs from the startup files folder and examine its content.
  • Specify the generic parameters in the GenericWFInitPage definition like this:

public class WFInit : GenericWFInitPage<InitFormData,AssocFormData>


  • In WFInit, define members for the aspx controls (grab the code from snippet1.txt)
  • GenericWFInitPage is an abstract class defined in my framework: you must implement 2 abstract methods:


    1. FromPageToInitData()  (grab the code from snippet2.txt)
    2. FromAssocToInitPage(AssocFormData assocFormData) (grab the code from snippet3.txt)


  • Submit the Initiation data to the workflow by providing an event handler to the OK button

       public void BtnOK_Click(object sender, EventArgs e)




  • Modify the provided install.bat file to make sure your feature is activated at your site collection url.
  • Rebuild your project and test the workflow.

3.Using the Initiation or Association form data from the workflow


  • In the workflow double click the OnWorkflowActivated1 activity to generate an event handler.
  • In this event handler add the code provided in snippet4.txt.
  • Rebuid and test your workflow

This hands-on training is the property of Redwood S.L sprl and may not be organized in class or in group without the prior written permission of Serge Luca. Should you wish to organize this hands-on training in your company or institution, please contact Serge Luca first to enter into a licence agreement. Each trainer or teacher using this hands-on training should have a licence agreement. Please ask your trainer or Serge Luca whether he or she has entered into a licence agreement with Redwood S.L sprl.

The hyperlink to this hands-on training may be placed on your website for free, on the condition that the name Serge Luca is clearly mentioned in the reference. Please send us a mail containing the link to the web page our reference is used on.


8 responses to “Step by Step Tutorial.Creating workflows with Windows Sharepoint Services and MOSS 2007 (part 15/20).Easy ASPX Initiation Forms-(my small generic framework)

  1. Hi, friend. I am from china chongqing, thank you provide\’s tutorial. It is very good and utility. Hope you can continue write tutorial.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s