Modifica

Condividi tramite


DataDOMEvent.NewValue Property

Definition

Gets the value of an XML Document Object Model (DOM) node that is being updated or inserted during a data validation event.

public:
 property System::Object ^ NewValue { System::Object ^ get(); };
public object NewValue { get; }
member this.NewValue : obj
Public ReadOnly Property NewValue As Object

Property Value

Examples

In the following example, the OldValue property of the DataDOMEventObject object is used to display the original value of an XML DOM node, along with its NewValue:

thisXDocument.UI.Alert("Original value: " + e.OldValue.ToString() + "\nNew value: " + e.<span class="label">NewValue</span>.ToString());

In the following example, the NewValue property of the DataDOMEvent is checked for a blank value. If not blank, the "FirstName" and "Lastname" fields are cleared.

 if (e.IsUndoRedo)
 {
  // An undo or redo operation has occurred and the DOM is read-only.
  return;
 }

 // A field change has occurred and the DOM is writable. Write code here to respond
 // to the changes.
 if (e.<span class="label">NewValue</span>.ToString() == "")
 return;

 if (thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Employees/@FirstName").text != "")
thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Employees/@FirstName").text = "";

 if (thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Employees/@LastName").text != "")
thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Employees/@LastName").text = "";

Remarks

The NewValue property contains the value of the XML DOM node that will replace the existing value. To get the original value of the XML DOM node, use the OldValue property.

Applies to