DataDOMEvent.NewValue 属性

定义

获取 XML 文档对象模型 (DOM) 节点的值(该值在数据验证事件中被更新或插入)。

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

属性值

示例

在以下示例中 OldValue , 对象的 属性 DataDOMEventObject 用于显示 XML DOM 节点的原始值及其 NewValue

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

在以下示例中,检查 DataDOMEventNewValue 属性是否为空值。 如果不为空,则清除“FirstName”和“Lastname”域。

 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 = "";

注解

NewValue 属性所包含的 XML DOM 节点的值将替换现有值。 若要获取 XML DOM 节点的原始值,请使用 OldValue 属性。

适用于