InfoPath form dynamically from ASP.NET - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

InfoPath form dynamically from ASP.NET

Last post 09-07-2010 04:43 PM by Potemkine. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 08-02-2005 07:55 AM

    • rrs
    • Not Ranked
    • Joined on 02-11-2005
    • USA
    • Posts 5

    InfoPath form dynamically from ASP.NET

    Is it possible to serve InfoPath form dynamically from ASP.NET. I am using a webservice to popluate a datagrid on asp.net page and have a link button("Edit"). Once I click the link button the employeeid for that particular record will be passed to infopath form and I want the webservice to get the values for that id and display it on the form. Then, the user could make whatever changes necessary and post back to a web service from the infopath form by clicking the submit buton.

    Is it possible with InfoPath. Can you guide me to right resource please?

    Thanks,
    RRS
  • 08-02-2005 05:08 PM In reply to

    • Shyam
    • Not Ranked
    • Joined on 08-02-2005
    • Posts 10

    Re: InfoPath form dynamically from ASP.NET

    Hi RRS,

    One way to do this is throwing the appropriate XML file from your ASP.NET page. Details : Take the blank template.xml of the published solution that you want to show the user. Add the employee details into this xml file and then "throw" this xml file into the browser as attachemnt. User will get the standard "Open/Save/Cancel" dialog. When they click on "Open", InfoPath form will open with that xml.

    Shyam
    InfoPath Dev
    India
    Shyam
    InfoPath Dev
    India
  • 08-02-2005 05:51 PM In reply to

    Re: InfoPath form dynamically from ASP.NET

    Hi Shyam and welcome to our forum!
    :)

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 08-12-2005 05:46 AM In reply to

    • rrs
    • Not Ranked
    • Joined on 02-11-2005
    • USA
    • Posts 5

    Re: InfoPath form dynamically from ASP.NET

    Thanks Shyam for the information. It was very helpful.

    RRs
  • 08-12-2005 08:15 AM In reply to

    Re: InfoPath form dynamically from ASP.NET

    Hi RRs,
    If you have written code for throwing xml, can you post a sample here? It would be helpful for forum members.

    Agni
    InfoPath Dev India
  • 09-05-2010 04:21 PM In reply to

    Re: InfoPath form dynamically from ASP.NET

    can u help me

     i want to create infopath form from asp.net appliction dynamically so there is no template for this form  so how can i create form and template in run time?

    i used this code

     

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Web;

    using System.Web.UI;

     

     

     

    public partial class _Default : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            string requestType = "Request for dynamic request forms";

            string requestTitle = "My dynamically created request";

            string estimatedCost = "123";

            string user = "ASDx";

            string costCenter = "999888777"; // TODO: get cost center from UserProfile

            int classification = 54321;

     

     

            string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +

              "<?mso-infoPathSolution solutionVersion=\"1.0.0.8\" productVersion=\"12.0.0\" " +

              "PIVersion=\"1.0.0.0\" href=\"" +

              "http://demo1:1000/PressReleases/Request%20forms/Forms/template.xsn\" " +

              "name=\"urn:schemas-microsoft-com:office:infopath:" +

              "Request-forms:-myXSD-2007-11-07T19-32-12\" ?>" +

              "<?mso-application progid=\"InfoPath.Document\" " +

              "versionProgid=\"InfoPath.Document.2\"?>" +

              "<my:myFields xmlns:my=\"" +

              "http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-07T19:32:12\" " +

              "xml:lang=\"en-us\">" +

                // Here I fill the fields:

              "<my:RequestType>" + requestType + "</my:RequestType>" +

              "<my:RequestTitle>" + requestTitle + "</my:RequestTitle>" +

              "<my:EstimatedCost>" + estimatedCost + "</my:EstimatedCost>" +

              "<my:User>" + "ASD" + "</my:User>" +

              "<my:CostCenter>" + costCenter + "</my:CostCenter>" +

              "<my:Classification xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +

              classification + "</my:Classification>" +

              "</my:myFields>";

            this.Page.Response.Clear();

            this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=Request-" +

              DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"));

            this.Page.Response.ContentType = "application/ms-infopath.xml";

            this.Page.Response.Write(xml);

            this.Page.Response.Flush();

            this.Page.Response.End();

     

     

        }

    }


     

  • 09-06-2010 02:52 AM In reply to

    Re: InfoPath form dynamically from ASP.NET

    you can create forms (xml) at run time but you cant create template(xsn) at run time

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 09-06-2010 07:48 AM In reply to

    Re: InfoPath form dynamically from ASP.NET

    thanks for ur replay Qazi 

    can i design blank tempalte and assign any form to it with any controls in the created form  or the design of temaplte must same as the design of form

  • 09-06-2010 08:28 AM In reply to

    Re: InfoPath form dynamically from ASP.NET

    No you cant design a blank template and assing any form to it, template is supposed to be a blue print for the form, the schema of the form and template should match,

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 09-06-2010 10:09 AM In reply to

    Re: InfoPath form dynamically from ASP.NET

    Thanks Qazi

    i know what you mean but in this situation all what i mean is that i am trying to repeat a textbox element inside the infopath form by generating it's string in the runtime appending it to right positions and save it.

    what i want to do is to generate a infopath form by asp.net  and download it by user request based on data from a gridview. so i think to combine all the 5 files of the infopath form template in one single xml string and render it to the user as an infopath form template.

     i am sure that this is a different approach of dealing with data but it's must and i've got puzzled since week trying to achieve it. so if you have more information i will be much more thankful :)

    Qazi aAnis:

    No you cant design a blank template and assing any form to it, template is supposed to be a blue print for the form, the schema of the form and template should match,

     

     

  • 09-06-2010 11:32 AM In reply to

    Re: InfoPath form dynamically from ASP.NET

     Hi mahmoudhamdy, Why you don't design a new Infopath form template with your 5 files template. If you build a xml file that match with that template, I think it can works. 

  • 09-06-2010 08:19 PM In reply to

    Re: InfoPath form dynamically from ASP.NET

    if you need to repeat a textbox element, using a repeating control like a repeating section or a repeating table.

    I am not sure what you mean by combining all theh 5 files of the infopath form template in one single xml string...

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 09-07-2010 04:43 PM In reply to

    Re: InfoPath form dynamically from ASP.NET

     I mean design a new form template with a main datasource who combine (you can make 5 childs nodes) all the 5 mains datasources of the differents templates . He make this template with Infopath. After that he build his xml with his code to match to this new template. I never do that, but I think it can work.

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