Open Exiisting Infopath Form from within - InfoPath Dev
in

InfoPath Dev

Open Exiisting Infopath Form from within

Last post 03-03-2010 01:22 PM by Karsten Brocksieper. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-01-2010 04:13 AM

    Open Exiisting Infopath Form from within

    I have an infopath form that lists all submitted items in a drop down menu.

    However, how do I Open one of these forms with a button?

    Im guessing I can run a query to populate some fields to view the data but I really want to open the form!

    any help, greatly appreciated.

     

  • 03-01-2010 09:01 AM In reply to

    Re: Open Exiisting Infopath Form from within

    Hi Bricey,

    ... I guess you can open an infopath form within a form with the following code:

    using Microsoft.Office.InfoPath;
    using System;
    using System.Xml;
    using System.Xml.XPath;
    using System.Web;

    string form_URL  = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:URL", NamespaceManager).Value;

    HttpContext.Current.Response.Redirect(form_URL  , false);

    Hope that helps...

    Karsten
  • 03-02-2010 12:48 AM In reply to

    Re: Open Exiisting Infopath Form from within

    Karsten

    Thanks for the input, Im getting

    Error 1 The name 'HttpContext' does not exist in the current context.

     My code looks like this, hope you can advise!

     

    using Microsoft.Office.InfoPath;

    using System;

    using System.Xml;

    using System.Xml.XPath;

    namespace ContractsDB

    {

    public partial class FormCode

    {

    // Member variables are not supported in browser-enabled forms.

    // Instead, write and read these values from the FormState

    // dictionary using code such as the following:

    //

    // private object _memberVariable

    // {

    // get

    // {

    // return FormState["_memberVariable"];

    // }

    // set

    // {

    // FormState["_memberVariable"] = value;

    // }

    // }

    // NOTE: The following procedure is required by Microsoft Office InfoPath.

    // It can be modified using Microsoft Office InfoPath.

    public void InternalStartup()

    {

    ((
    ButtonEvent)EventManager.ControlEvents["CTRL24_10"]).Clicked += new ClickedEventHandler(CTRL24_10_Clicked);

    }

    public void CTRL24_10_Clicked(object sender, ClickedEventArgs e)

    {

    string form_URL = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:URL", NamespaceManager).Value;HttpContext.Current.Response.Redirect(form_URL , false);

    }

    }

    }


     

  • 03-03-2010 01:22 PM In reply to

    Re: Open Exiisting Infopath Form from within

    Hi,

    ... additionally you have to include a reference to 'System.Web'.

    First you have to add the reference in the solution explorer --- and after this you can define the appropriate 'using' Statement:

    ...
    using System.Web;
    ...

    The you can (for example) define the variable form_URL as:

    ...
    string form_URL = "http://www.google.com";
    ...

    If this would properly function you can replace the url with your concatenated url to open the correct form.

    Regards,

    Karsten
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.