ASPX Controls for k2 blackpearl


Badge +11

A library of custom controls that can be used to workflow-enable nearly any ASPX page with little or no coding. The submit control encapsulates many features that developers normally repetitively code on each web page. Once connected to the workflow server, the control will automatically display all actions defined for the activity. The user can then choose an appropriate action and submit, with no code required by the developer. Page-to-page flow (without making the user go back to the worklist


19 replies

Badge +11
Almost ready to post

- testing 


- refactoring code and adding comments


- working on documentation

Badge +11
Opinion Please: Design Options for K2Panel Control

I'm working on a new control to add to the library called K2Panel.  This control will work with K2Submit.  Add a K2Panel to the page, then you can add standard ASP.NET controls to the panel.  If the ID of the control matches a K2 activity or process level variable, the panel will take care of moving data back & forth between the workflow and controls.


 Design question:


The developer could attach a numeric K2 field, like decimal to a textbox control.  Who should be responsible for validating the user entry?  Should the K2Panel validate the data entered is valid for the datatype?  Or should that be left to the developer?  Remember, the K2Submit control already fires a validate event that allows the developer to do any edit validation.


 Please let me know what you think.

Badge +9
Re: Opinion Please: Design Options for K2Panel Control

If it where me, at least initially, I'd probably leave it up to the developer to do the validation.  I can see a situation where you put in basic data type validation but more robust validation being required (like valid ranges, min/max values...) at which point you're back to the same question.


 

Badge +2
Re: Opinion Please: Design Options for K2Panel Control

I would agree - leave the developer to validate their own field, especially if there is an event for that anyway.

 Or, I suppose there might be a third option - both. The K2Panel makes sure that the data isn't something really wacky, like text into decimal, but that the developer still has the option to validate that the value is one they'd expect.
 

Badge +5
Missing K2 serial number

Hi,

I'm having this message when I need to start the form initiation: Missing K2 serial number

I Still don't get it, how can I create the first form to be submitted with the creation of the work item serial number. Do I need to create new instance from the K2BP workspace each time, and then start the process from the work items.

 

Regards,

Saleh 

Badge +11
Re: Missing K2 serial number

Saleh,


Are you asking how to start a workflow using the aspx controls for blackpearl project in blackmail?  Sorry, I didn't include that feature in the project.  Right now it can only be used in client events.  That should be a relatively easy feature to add, but I just haven't had time.  Here is some sample code you could use to start a workflow:


  SourceCode.Workflow.Client.Connection  conn = null;


        try
        {
            conn = new SourceCode.Workflow.Client.Connection();
            conn.Open("blackpearl"); //get from web.config


            SourceCode.Workflow.Client.ProcessInstance pi = conn.CreateProcessInstance("HardwareApprovalProcHardware Approval");  //web.config


            pi.DataFields["somefield"].Value = "some value";


            conn.StartProcessInstance(pi);


        }
        catch (Exception)
        {


            throw;
        }
        finally
        {
            if (conn != null) conn.Close();
        }

Badge +3
Issue when downloading the demo video files

Hi David, I tried to download the demo videos, but when requesting the download, it seems to bringup an aspx page with gibberish on it and the file download does not start.
Badge +11
Re: Issue when downloading the demo video files

There is an issue with the web site's event handler for this type of file.  Chris is working on it. 
Badge +5
Can't find any outcomes in the DropDownList

Hi,

I've used the ASPX control, it works perfectly with me. Except that I can find the outcomes designed in K2 Process Designer but sometimes I can't. I've correctly configured the  Action Results in the process activity and I can see those options in K2 workspace. But the ASPX Control in the web form can't view it.

 

Regards,

 

Badge +4
Re: Can't find any outcomes in the DropDownList

Hi Geek,


Did you use ADO.NET SqlDataProvider to retreive the actions?


Or you are using code?


I sometimes had problem with the Provider methods and simply use code:


(please make sure web.config has specified <identity impersonate='true'>


and using windows authentications)


  if (!this.IsPostBack)
        {
            string SN = Request.QueryString["SN"].ToString();


            using (Connection k2nn = new Connection())
            {
                k2nn.Open("BlackPearl");


                WorklistItem wli = k2nn.OpenWorklistItem(SN, "ASP", false);


                DropDownList1.DataSource = wli.Actions;
                DropDownList1.DataTextField = "Name";
                DropDownList1.DataValueField = "Name";
                DropDownList1.DataBind();


               //Display K2 datafileds or SmO data here....
                   k2nn.Close();
            }
        } 


 

Badge +5
Re: Can't find any outcomes in the DropDownList

Hi marcol888,

I guess that the problem was an authentication issue. It's a testing server and I didn't configured Kerberos completely. I hosted the web forms in the same server and it work...

Thanks for the tips!

 

Regards,

Saleh 

Badge +2
Re: Missing K2 serial number

I am also having this problem merely running the downloaded source code for this project. It looks like it's looking for a serial number in the URL of the when the project is run, but no serial number is supplied. What number should be put in there?

 

Thanks,

Kim 

Badge +5
Re: Missing K2 serial number

The serial number will be generated by K2, it means that the first page must be hardcoded to initiate a new instance of the process. Afterwards, the worklist item should redirect the user to a valid link that has the correct serial number for that work item (http://WorkspaceServer/ASPPage.aspx?SN=XX_XXX).

 

-Saleh 

Cannot populate the submit control

Dear,


I have tried all the specified ways in your videos and the control is not populating the outcomes


it is not displaying any error and no output (drop down is disabled)


can you please identify what could be the problem


please click the link to view the image error description


http://www.dropshots.com/getadkhan#date/2008-06-14/05:55:19


Regards, 


 

Badge +11
Re: Cannot populate the submit control

Make sure directory security on your web site is set to use integrated authentication and not anonymous.  Then in your web.config file, be sure to set <identity impersonate="true"/>.
Validation

I love your control...however I need to validate and require a comments field to be completed if the action selected equals 'Decline'. I am having difficulty determining how I would access the action's selected value using a dropdownlist. Do you have any input on what the best method would be? I watched the video and it seems to skip over the validation section. Thanks.
Badge +11
Re: Validation

Thanks!  I got tired of writing the same basic code over and over, so I packaged it up in a control.


The control fires an event called 'ValidateWorkflowFields'  that you can handle in the page.  In the validation event, return true if you consider the data entered to be valid and the event will be actioned.  Return false and the event will not be actioned (and you could inform the user that comments are required).


To handle this event, click the control on the canvas, then go to the Properties window.  Click the lightning bolt icon to access the events.  Type in the name of your event handler then double click.



When you add the name and double click a method stub will be generated.  A WorkflowEventArgs is passed into the event handler as the second parameter.  This argument has a property called SelectedAction that contains the action the user selected.  From there, you could write code to validate your data, for example, you might have something like this:



It shold be pretty straitforward.  The control also fires a couple other events you can use to load and save workflow fields.

Doing Something After Submit

Hello Again,


I have a case to use your control again, but this time I'd prefer to not have the screen reload and say "Activity Actioned" down by the control. Instead I would like to redirect the user to another page. I tried putting a redirect in SaveWorkflowFields as you will see below, but the activity does not get recorded if I redirect there. Any advice?


Protected

Sub K2Submit1_SaveWorkflowFields(ByVal sender As Object, ByVal item As SourceCode.Workflow.Client.WorklistItem) Handles K2Submit1.SaveWorkflowFields


HttpContext.Current.Response.Redirect("ResponseRecorded.aspx")


End Sub


 

Badge +11
Re: Doing Something After Submit

In the SaveWorkflowFields you could set a boolean flag to true.  Then add add a handler for the OnLoadCompleted event.  In that event if your flag is true, you can do the Response.Redirect.


 I am working on some updates to this control and I'll see if I about adding some sort of mechanism to make this easier.


David

Reply