Microsoft Office Tutorials and References
In Depth Information
Writing event validation for an expense report form
XmlChangedEventHandler(managerName_Changed);
((ButtonEvent)EventManager.ControlEvents["
Button_Submit"]).Clicked += new
ClickedEventHandler(Button_Submit_Clicked);
}
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
XPathNavigator xData = xDoc.SelectSingleNode("/my:expenseReport/
my:reportDate", this.NamespaceManager);
//Check and remove the "nil" attribute
if (xData.MoveToAttribute("nil", "http://www.w3.org/2001/
XMLSchema-instance"))
xData.DeleteSelf();
}
public void FormEvents_ContextChanged(object sender,
ContextChangedEventArgs e)
{
if (e.ChangeType == "ContextNode")
{
// Position a XPathNavigator on the DisplayContext field.
XPathNavigator rtNode, msgTxtBox;
rtNode = this.MainDataSource.CreateNavigator();
msgTxtBox = rtNode.SelectSingleNode("/my:expenseReport/
my:manager/my:managerEmailAddress",
this.NamespaceManager);
//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:
expenseReport/my:emailMessage", this.NamespaceManager);
// Set DisplayContext with the name of the current context
xData.SetValue("Current Context Name: " + e.Context.Name);
return;
}
}
public void managerEmailAddress_Changing(object sender,
XmlChangingEventArgs e)
{
 
Search JabSto ::




Custom Search