Add an application page to a workflow
Modify the Workflow code
First, add a line of code to the workflow to set the value of the outcome column to the amount shown on the zero claim sheet. This value will be used later in the expense statement rollup calculation.
Set the value of the outcome column in the workflow
1. The project completed in the SharePoint 2010 Workflow Solution: Creating a workflow topic with an associated form and a startup form is loaded into Visual Studio.
2. Open Workflow1.cs Code
3. Add the following code to the bottom of the Createtask1_methodinvoking method:
createtask1_taskproperties1.extendedproperties["result"] = Workflowproperties.initiationdata;
Create an Application page
Next, you add an ASPX form to your project. This form displays the data that is obtained from the expense statement workflow project. To do this, you will add an application page. Application pages use the same master page as other SharePoint pages, which means that the application pages will resemble other pages on the SharePoint site.
Add an application page to a project
1. Add the application page to the project. Right-click the YunCode.WorkFlow.Sequential item, point to Add, and then click New Project. Use the default name for the project item, that is, applicationpage1.aspx.
2. In applicationpage1.aspx XML, replace the PlaceHolderMain part with the following code:
<asp:content id= "Main" contentplaceholderid= "PlaceHolderMain" runat= "Server" >
<asp:label id= "Label1" runat= "Server" font-bold= "True" text= "excess expense Amount" font-size= "Medium" ></asp:Label>
<br/>
<asp:table id= "Table1" runat= "Server" >
</asp:Table>
</asp:Content>
This code adds a table and a title to the page.
3. Add the caption to the application page by replacing the Placeholderpagetitleintitlearea section with the following code:
<asp:content id= "Pagetitleintitlearea" contentplaceholderid= "Placeholderpagetitleintitlearea" runat= "Server" >
Reimbursement information
</asp:Content>
Writing Application page code
Next, add code to the claim Rollup application page. When you open the page, the code scans the list of tasks in SharePoint to find the amount that exceeds the allocated expense limit. The report lists each item together with the petty cash totals.
Writing Application page code
1. Click ApplicationPage1.aspx, and then click Code on the View menu to display the code behind the application page.
2. Replace the using or Import statements at the top of the class with the following code (depending on your programming language):
Using System;
Using Microsoft.SharePoint;
Using Microsoft.SharePoint.WebControls;
Using System.Collections;
Using System.Data;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Drawing;
Using Microsoft.SharePoint.Navigation;