Hosting the InfoPath Form Control in a Web Browser in .NET framework

Making QR Code 2d barcode in .NET framework Hosting the InfoPath Form Control in a Web Browser
Hosting the InfoPath Form Control in a Web Browser
QR Code 2d Barcode Generator In .NET
Using Barcode encoder for ASP.NET Control to generate, create QR image in ASP.NET applications.
Figure 1824: Adding the Initialize event handler in the host page for the XmlFormView1 control
Create Barcode In .NET Framework
Using Barcode printer for ASP.NET Control to generate, create barcode image in ASP.NET applications.
Now that we are sinking the Initialize event for the XmlFormView1 control, it s time to write the code to pass the parameters to the form Listing 1814 shows the code for adding form parameters to the form from within the ASPNET host page
QR Code 2d Barcode Drawer In C#
Using Barcode generation for Visual Studio .NET Control to generate, create QR Code JIS X 0510 image in .NET framework applications.
Listing 1814: Sinking the XmlFormView1: Control s Initialize Event to Pass a Parameter to the Form
QR Code 2d Barcode Creator In .NET Framework
Using Barcode drawer for .NET framework Control to generate, create QR Code image in VS .NET applications.
protected void XmlFormView1_Initialize( object sender, InitializeEventArgs e) { string insurerName = RequestQueryString["InsurerName"]; eInputParametersAdd("InsName", insurerName); }
Create QR In Visual Basic .NET
Using Barcode printer for .NET framework Control to generate, create Quick Response Code image in .NET framework applications.
The form is now receiving our own InsName parameter from the ASPNET page However, the form template isn t actually using the parameter! To use the parameter, we ll write code in the form s Loading
Code 128 Code Set C Creation In VS .NET
Using Barcode creator for ASP.NET Control to generate, create Code 128C image in ASP.NET applications.
18: Hosting InfoPath
Printing Data Matrix ECC200 In .NET
Using Barcode maker for ASP.NET Control to generate, create Data Matrix ECC200 image in ASP.NET applications.
event handler to set the InsurerName eld It s important to know that both the InsurerName and InsName parameters are available to the form, but since we re masquerading the URL parameter, we want to use our own InsName parameter in form code The code in Listing 1815 is within the form template itself to use the parameter passed from the host page You ll nd a form template with the name LifeInsurance_BrowserEnabled_Loading in the samples for this chapter
Drawing Code 39 Full ASCII In .NET
Using Barcode drawer for ASP.NET Control to generate, create ANSI/AIM Code 39 image in ASP.NET applications.
Listing 1815: Sinking the Loading Event in the Form Template to Use the Parameters
Painting Bar Code In .NET Framework
Using Barcode drawer for ASP.NET Control to generate, create barcode image in ASP.NET applications.
public void FormEvents_Loading(object sender, LoadingEventArgs e) { string insurerNameParam = eInputParameters["InsName"]; if (!stringIsNullOrEmpty(insurerNameParam)) { XPathNavigator root = thisCreateNavigator(); XPathNavigator insurerName = rootSelectSingleNode("/my:myFields/my:InsurerName", NamespaceManager); insurerNameSetValue(insurerNameParam); } }
Print EAN 13 In .NET Framework
Using Barcode generator for ASP.NET Control to generate, create EAN / UCC - 13 image in ASP.NET applications.
WARNING
USS-128 Creator In VS .NET
Using Barcode generation for ASP.NET Control to generate, create EAN128 image in ASP.NET applications.
Do Not Assume the Existence of Parameters
UPC-E Printer In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create GS1 - 12 image in ASP.NET applications.
In Listing 1815 we rst check for a missing parameter by using the IsNullOrEmpty static method of the String class This is a safety check that should always be performed when reading parameters in your form If the parameter doesn t exist, you may want to cancel the Loading event (eCancelableArgsCancel = true), which will fail loading of the form
Making UCC - 12 In Visual Studio .NET
Using Barcode drawer for VS .NET Control to generate, create UCC - 12 image in .NET applications.
Since we ve added form code to our form template, it can no longer be user activated through the InfoPath Publishing Wizard to a document library Our only option is to use the Publishing Wizard to publish an administrator-approved form template ( 17 discusses publishing and activating form templates for administrator approval) Once the form template is activated with InfoPath Forms Services, it will have a different
Create EAN / UCC - 13 In VS .NET
Using Barcode generator for VS .NET Control to generate, create UCC - 12 image in Visual Studio .NET applications.
Hosting the InfoPath Form Control in a Web Browser XsnLocation than our previous form template without code Be sure to
Bar Code Drawer In Visual Studio .NET
Using Barcode encoder for .NET framework Control to generate, create barcode image in VS .NET applications.
update the XsnLocation of the XmlFormView1 control with the new URL You may also want to reset the visibility style on the control to be visible so we can see our form when we rst navigate to the host page To see how our host page and form now work, navigate your browser to http://localhost/XmlFormView/MyPageaspx InsurerName=Tom%20 Collins, and you ll see that the insurer name appears as Tom Collins
Recognize GS1 - 13 In VS .NET
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
Writing InfoPath Form Code in the Host Page Using XmlFormView
Code 39 Creation In Visual Basic .NET
Using Barcode printer for .NET Control to generate, create Code 39 image in Visual Studio .NET applications.
In these last few examples, you ve had a taste of InfoPath form code in the host page So far we ve used the MainDataSource, NamespaceManager, and InputParameters objects to communicate to the InfoPath form in the browser These properties are all members of the InfoPath object model (OM) that you would normally use within the code of a form template In fact, almost the entire InfoPath OM is at your disposal through the XmlForm property of the XmlFormView control! You can apply any of the same browser-enabled form code concepts from s 15 and 17 to writing code using the InfoPath OM in a host page Before we discuss the XmlForm property exposed by the XmlFormView control, let s rst look at all of the properties (there are no useful public methods) that are speci cally exposed by the XmlFormView control Keep in mind that IntelliSense will list much more than what we show in Table 184 This is because the XmlFormView class inherits from the SystemWebUI WebControlsWebPartsWebPart class Some of these properties are useful for customizing the look of the form, while others let you con gure speci c aspects of the behaviors of the XmlFormView control or even the form
UCC.EAN - 128 Generator In Java
Using Barcode creator for Java Control to generate, create UCC.EAN - 128 image in Java applications.
Decode Bar Code In .NET
Using Barcode reader for .NET Control to read, scan read, scan image in VS .NET applications.