Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I followed the Code

protected override void CreateChildControls()
        {
            XmlFormView formView;
            formView = new XmlFormView();
            formView.Width = ASP.Unit.Percentage(100);
            formView.Height = ASP.Unit.Pixel(100);
            formView.XsnLocation = "Path to form XSN";
            formView.ShowHeader = false;
            formView.ShowFooter = false;

            this.Controls.Add(formView);
            base.CreateChildControls();
        }   

for showing the InfoPath form in a webpart. I am a getting valid InfoPath form in the SharePoint webpart.

But when I follow the same code for showing InfoPath form in the Custom Master page application, I could not able to show the InfoPath form. How can I acheive this?

share|improve this question
    
I have closed your near identical earlier question sharepoint.stackexchange.com/questions/22759. –  SPDoctor Nov 6 '11 at 17:23

2 Answers 2

By default a masterpage does not allow inline code for security reasons and I personally would not change this behavior for security measures.

Your best bet is to develop either:

  • A custom WebPart and add it to a WebPart page of your choice.
  • A custom layouts ASPX page of your choice with embedded code.
  • A custom WebControl and add it to the masterpage of your choice.
share|improve this answer

You might this solution: http://grounding.co.za/blogs/romiko/archive/2009/09/24/integrating-infopath-forms-using-xmlformview-control-with-aspx-pages.aspx. In this solution, the InfoPath control is called via an ASP.NET control on the ASPX page instead of the code-behind.

share|improve this answer
    
I followed this Blog.I am not adding Xmlforview tag (for e.g<Cc1:XmlFormView ID="XmlFormView1" Style="width:100%;" runat="server"/> in Aspx page.But In code behind i have written the Code –  user876869 Nov 7 '11 at 15:14
    
Dynamically In code behind i have written the Code protected void Page_Load(object sender, EventArgs e) { XmlFormView formview = null; formview = new XmlFormView(); formview.Width = Asp.Unit.Percentage(100); formview.Height = Asp.Unit.Pixel(800); formview.XsnLocation = "dev/formlibrary/forms/template.xsn";; formview.ShowHeader = false; formview.ShowFooter = false; formview.Hidden = false; this.Page.Controls.Add(formview); } Can i know where i am doing wrong ? –  user876869 Nov 7 '11 at 15:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.