Microsoft Office Tutorials and References
In Depth Information
Form-level events
An example of the solution xsi:nil="true" attribute
Microsoft Office InfoPath forms are prepared by connecting to a Web Service
Contract-First WSCF ) web services. When you examine the schemas, you will (
not find the nullable attribute that equals "true" in the XML Schema Definition
XSD ) generated ( ( .XSD file) by InfoPath. The XSD is referred to as the XML Schema
language. xsi:nil="true" is the nullable attribute that we need to handle in
the InfoPath.
// Create a Navigator object to access the main DOM.
XPathNavigator xDoc = this.MainDataSource.CreateNavigator();
// Create a Navigator object for the field that you want to set.
XPathNavigator xData = xDoc.
SelectSingleNode("/my:myFields/my:myName",
this.NamespaceManager);
// Check and remove the "nil" attribute.
if (xData.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema
-instance"))
xData.DeleteSelf();
// Set the value of the myName field.
xData.SetValue("Vivek");
// Data clean up.
xDoc = null;
xData = null;
The following sections describe the use of the events that you can select from the
Programming submenu.
Loading event
After you work through the menu options shown in the previous image, an event
handler will be created in your code to handle the specific event. Let's work through
a sample to see how the Loading event works in the InfoPath form.
FormEvents_Loading(object sender, LoadingEventArgs e)
The following example will load information about the currently logged-in user.
The form will display the user's name by returning this information from the
Loading event.
public void FormEvents_Loading(object sender, LoadingEventArgs e)
{
// Create a Navigator object to access the main DOM
XPathNavigator xDoc = this.MainDataSource.CreateNavigator();
// Create a Navigator object for the field that you want to set
 
Search JabSto ::




Custom Search