Viewflow component in a webform

Last post 05-21-2008, 9:11 PM by Bob. 9 replies.
Sort Posts: Previous Next
  •  11-18-2005, 11:02 13902

    Viewflow component in a webform

    Hi

    I want to make use of the viewflow component(http://kb.k2workflow.com/Articles/KB000023.aspx) in a webpage. This component should be working in a windows or web application, but this component is a windowscontrol, how can this work????. How can I use this component in a webapplication? I don't want to make use of the Workspace/K2MIS/ViewFlow.aspx page but my own custom page.

    Can someone give me the solution?

    Thanx
  •  11-21-2005, 3:24 13903 in reply to 13902

    Viewflow component in a webform

    Hi,

    You can build your own ViewFlow page with very little effort. You will need to add some code in both the aspx and the code behind file of your custom ViewFlow page.

    For the aspx file:
    Add a javascript function called ‘window_onload’ to be called when the onload event of the body object is called.
    [code:1:7a5eabeab9]<SCRIPT language="javascript" id="clientEventHandlersJS">
    function window_onload()
    {
    if (document.all('errormessage').value == '')
    {
    document.getElementById('ViewFlow').Xml = document.getElementById('strXML').value;
    document.getElementById('ViewFlow').ScrollBars = true;
    return true;
    }
    else
    {
    alert(document.getElementById('errormessage').value);
    return false;
    }
    }
    </SCRIPT>[/code:1:7a5eabeab9]
    And add the call to the onload event of the body tag:
    [code:1:7a5eabeab9]<body MS_POSITIONING="GridLayout" onload="return window_onload()">[/code:1:7a5eabeab9]
    Add an Object tag to the page to display the image generated by the ViewFlow component:
    [code:1:7a5eabeab9]<OBJECT id=ViewFlow height="90%" width="90%" border=1
    classid=http:ViewProcessInstance.dll#ViewProcessInstance.ViewControl
    VIEWASTEXT>
    </OBJECT>[/code:1:7a5eabeab9]
    You will also need to add two hidden controls to hold the XML needed for the image generation and any errors that may occur:
    [code:1:7a5eabeab9]<input type="hidden" id="strXML" Runat="server" />
    <input type="hidden" id="errormessage" Runat="server" />[/code:1:7a5eabeab9]
    For the code behind, you will need to add a reference to K2ROM.dll and populate the "strXML" hidden field with the XML needed to generate the ViewFlow image:
    [code:1:7a5eabeab9]private void Page_Load(object sender, System.EventArgs e)
    {
    if (! IsPostBack)
    {
    SourceCode.K2ROM.Connection K2Conn = new SourceCode.K2ROM.Connection();
    try
    {
    K2Conn.Open("MyK2Server");

    // Get the Xml from K2 server using the process instance ID,
    // passed in the URL
    string sXML = K2Conn.ViewProcessInstance(Convert.ToInt32(Request.Params["ProcInstID"]));

    strXML.Value = sXML; // strXML is the hidden control
    // declared in the aspx file.
    }
    finally
    {
    K2Conn.Close(); // Always close connection to K2 server
    }
    }
    }[/code:1:7a5eabeab9]

    Lastly, make sure that a copy of the ViewFlow.dll is in the same folder as your custom ViewFlow page. You can get the original dll from "C:\Program Files\K2.net 2003\K2WS\Workspace\K2MIS", assuming of course you installed K2 in the default location.
  •  08-01-2007, 12:31 17415 in reply to 13903

    Re: Viewflow component in a webform

    Sir, If I do not start a process yet. Can I show the process flow graph?
  •  08-02-2007, 1:38 17441 in reply to 17415

    Re: Viewflow component in a webform

    Hi pochien,

    No, unfortunately the K2Conn.ViewProcessInstance method call takes a Process Instance ID as parameter.  A ProcessInstanceID is only generated for running process instances i.e. you'll need to start a process instance before displaying the Viewflow.

    Regards,

    Ockert


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
  •  08-02-2007, 4:57 17447 in reply to 17441

    Re: Viewflow component in a webform

    If you just need to show the flow without process progress, you can just feed the Process XML definition to the viewflow component. So you can store the process XML definition into the database, and when you like to show the flow chart(like in K2 studio), you got the XML document and send to viewflow component.
    Michael Peng
    Technical Director of Greater China, K2
  •  08-19-2007, 8:32 PM 17864 in reply to 17447

    Re: Viewflow component in a webform

    Hi Michael,

    Would you please tell me how to use the XML file , when I want to show the flow chart as K2Studio? 

  •  10-04-2007, 11:03 19035 in reply to 13903

    Re: Viewflow component in a webform

    Hi ,

    I create a viewflow page. But some user's computer cannot view the flow chart . We check the computers, they did not install .Net Framework . Does the ViewFlow solution go to run under client user's .Net Framework?

    Does it possible can be run under the environment without .net framework?

     Pochien

  •  10-05-2007, 4:14 19039 in reply to 19035

    Re: Viewflow component in a webform

    Yes, unfortunately it does need the .Net Framework on the client machine.

    Regards,

    Ockert


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
  •  05-20-2008, 11:35 PM 23924 in reply to 13903

    Re: Viewflow component in a webform

    Hi,

    I have this working perfectly from my machine, however when I deploy it to my web server (which also has K2 installed) it does not display the image

  •  05-21-2008, 9:11 PM 23956 in reply to 23924

    Re: Viewflow component in a webform

    You may consider checking out out KB000094 ("No Image displayed after clicking the “View Flow” link from the Workspace");

    http://kb.k2workflow.com/articles/kb000094.aspx

     

    HTH.


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
View as RSS news feed in XML