WFTaskGridControl

The implementation of this Web Control shows a user Task List on the page at run time. The AgilePoint Task List supports the following functions:

Properties

Field Name Definition
AutoGeneratecheckboxColumn

Determines whether a check box column will automatically be generated at run time.

ContextMenuCssClass

This property enables the inclusion of a CSS style sheet. The following is an example.

.RightMenu
{
    border-right: 2px outset;
    border-top: 2px outset;
    border-left: 2px outset;
    border-bottom: 2px outset;
    background-color: buttonface;
}
.RightMenu hr
{
    width: 100px;
}
.RightMenu ul
{
    list-style: none; margin:0; padding:0;
}
.RightMenu ul li
{
    vertical-align: bottom;
}
.RightMenu A { color: MenuText;
    text-decoration: none; display:
    block; width: 100px;
    text-align:center; line-height:20px }
.RightMenu A:link { color: MenuText;
    text-decoration: none; }
.RightMenu A:active { color: MenuText;
    text-decoration: none; }
.RightMenu A:visited { color: MenuText;
    text-decoration: none; }
.RightMenu A:hover { color: HighlightText;
    background-color: Highlight; }
ContextMenus

The ContextMenus property provides an editor for maintaining the menu items.

To separate the menu items, enter <hr /> into the Text property.

If you set the BoundCommandName property, you must set a ButtonField in columns property which is for the command of the menu item.

If you set the NavigateUrl you can use for example: ProcessView.aspx?PIID={ProcInstID} in the {} is the fields in DataKeyNames property. And if desired the URL will open in a new window by setting the target property to _blank.

GroupBackColor

Determines the background color of the title bar when grouping.

GroupFontColor

Determines the font of the title bar when grouping.

Inherits

  • System.Web.UI.WebControls.GridView

Usage

You must create a QueryTaskListData event by double-clicking the QueryTaskListData property.

Here is some sample code in the QueryTaskListData Event.

IWFWorkflowService api = GetAPI();
        string statusList = string.Format("{0};{1};{2}",
                WFManualWorkItem.ASSIGNED, WFManualWorkItem.OVERDUE,
                WFManualWorkItem.PSEUDO);
        WFManualWorkItem[] wks =
                api.GetWorkListByUserID(GetCurrentUser(), statusList);
                
        if (wks == null) wks = new WFManualWorkItem[0];
        TaskGridControl.QueryTaskListEventArgs qArgs =
                e as TaskGridControl.QueryTaskListEventArgs;
qArgs.Data = wks;

You can write TaskGridControl1.Binding();  in the update page function.

If you have set a command in the Context Menu, you need to design the RowCommand event by double-clicking the RowCommand property.

Below is sample code:

int index;
        if (!int.TryParse(e.CommandArgument as string,
                out index)) return;
        DataKey data = TaskGridControl1.DataKeys[index];
        string wid = data.Values["WorkItemID"] as string;
        string TaskForm = data.Values["Name"] as string;
        string pid = data.Values["ProcInstID"] as string;
        switch (e.CommandName)
        {
            case "DoTask":
                Response.Redirect("../" + TaskForm +
                        ".aspx?WID=" + wid);
                break;
            case "ViewProcess":
                string url = "ProcessViewer.aspx?PIID=" + pid;
                string script = @"<script
                        language='javascript'> " +
                        @"var szFeatures = 'scrollbars=yes,
                        width=770,height=500,resizable=yes';" +
                        @"window.top.open('" + url + "',
                        'ProcessViewer', szFeatures);" + @"
                        </script> ";
                Page.ClientScript.RegisterStartupScript(Page.GetType(),
                        "", script);
                break;
            case "CreateLinkWorkItem":
                IWFWorkflowService api = base.GetAPI();
                api.CreateLinkedWorkItem(wid, TaskForm,
                        "Administrator", null, null);
                break;
            case "Test":
                int[] i = this.TaskGridControl1.GetSelectedIndices();
                IWFWorkflowService api1 = base.GetAPI();
                foreach (int s in i)
                {
                    DataKey d = TaskGridControl1.DataKeys[s];
                    string id = data.Values["WorkItemID"] as string;
                    //api1.CompleteWorkItem(id);
                }
                break;
            default:
                break;
        }
        UpdatePage();
Note: If you want to get the rows which check box selected you just need to call the function like this: int[] i = this.TaskGridControl1.GetSelectedIndices();