XmlDataSource::Data Property
Gets or sets a block of XML data that the data source control binds to.
Assembly: System.Web (in System.Web.dll)
[PersistenceModeAttribute(PersistenceMode::InnerProperty)] [TypeConverterAttribute(L"System.ComponentModel.MultilineStringConverter,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public: virtual property String^ Data { String^ get (); void set (String^ value); }
<asp:XmlDataSource> <Data>String</Data> </asp:XmlDataSource>
Property Value
Type: System::StringA string of inline XML data that the XmlDataSource control binds to. The default value is String::Empty.
| Exception | Condition |
|---|---|
| InvalidOperationException | The document is loading. |
In declarative scenarios, the Data property is specified as a multiline inner property of the XmlDataSource object. An inner property is compatible with XML data, because it enables you to format the XML data in any way and ignore character padding issues, such as padding quote characters.
If both the DataFile and Data properties are set, the DataFile property takes precedence and the data in the XML file is used instead of the XML data specified in the Data property.
If you change the value of the Data property, the DataSourceChanged event is raised. If caching is enabled and you change the value of Data, the cache is invalidated.
The following code example demonstrates how to use an XmlDataSource control to display inline XML data contained by the Data property with a TreeView control.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.