kamagra how much to take

XmlFormView Control And Forms Services

The XmlFormView control plays the central role in rendering the display to a user in an HTML compatible format. When not using the Forms Service XmlFormControl within a WebPart, it becomes exceptionally difficult to develop a custom solution to render out the InfoPath form. It could be theorized that one could load the InfoPath XML document by calling a StreamReader on the XML contents, go through all the XML contents, use LoadXml to load the streamed contents, apply the relevant style by looping through the nodes, and other methods. However it is much easier to do it with the Forms Services native XmlFormView control by simply calling it out, and a lot of the methods that would have to be custom written otherwise are handled by the control.

The XmlFormView control can also be consumed from within a SharePoint WebPart or a SharePoint WebPart Page because the required page references are already stored within the SharePoint 12 hive.

WebPartPage XmlFormView Control Registration and Placement

There are very few requirements to get the control to display on a WebPart page within SharePoint. Namely, making the references to the appropriate assemblies to consume the control and then declaratively calling the XmlFormView control. Therefore, it is possible to open a WebPart page using SharePoint Designer. Call the XmlFormView control on the page, and set the relevant properties to point to the .XSN file location.

  1. <%@ Register Tagprefix="InfoPath"
  2. Namespace="Microsoft.Office.InfoPath.Server.Controls" Assembly="Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

For some environments, a more modular approach is required, and therefore the XmlFormView should be packaged within a SharePoint WebPart to display relevant InfoPath forms. In order to consume the XmlFormView control within a WebPart, the task is pretty straightforward. Make a reference to the Microsoft.Office.InfoPath.Server assembly and declare a field to hold the control.

  1. private XmlFormView proSP2007Form;

Override CreateControlControls()

Like the rendering of all child controls that exist in .NET, we simply have to override the CreateChildControls() method and then call out the XmlFormView Control.

  1. protected override void CreateChildControls()
  2.  
  3. {
  4.  
  5. base.CreateChildControls();
  6.  
  7. proSP2007Form = new XmlFormView();
  8.  
  9. proSP2007Form.XsnLocation = "proSharePoint2007XSNlocation";
  10.  
  11. this.Controls.Add(proSP2007Form);
  12.  
  13. }

Then following in the RenderWebPart method, override the RenderWebPart method and output the XmlFormView control.

  1. protected override void RenderWebPart(HtmlTextWriter output)
  2.  
  3. {
  4.  
  5. EnsureChildControls();
  6.  
  7. base.RenderContents(output);
  8.  
  9. }

By filling in the XSNLocation property, the XSN you want displayed is rendered through a WebPart. If you want to extend the WebPart, use a WebPart property to make the XSN location property adjustable by users through the WebPart ToolPane.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>