Contents
Licensing
Installation and deployment
DNN
Feature overview
New to Telerik RadPanelBar?
Already using the control
AJAX support
ASP.NET 2.0 features
Data Binding
Telerik RadPanelBar client-side
Telerik RadPanelBar server-side
Example scenarios (How to)
Controlling the visual appearance
Defining the Telerik RadPanelBar structure
Custom Attributes
Templates
Troubleshooting
API Reference
|
|
| XmlDataSource |
Send comments on this topic. |
| See Also |
|
|
ASP.NET 2.0 features > Declarative data source support > XmlDataSource |
 |
When Telerik RadPanelBar is bound to an XmlDataSource, it will create panelbar item hierarchy automatically. However, unlike SiteMapDataSource, properties such as Text and NavigateUrl will not be automatically populated. |
Please, consider the following example:
- Add the following xml file in the App_Data folder:
| |
Copy Code |
|
|
-
Drag an instance of the XmlDataSource in the web form and configure the control:
-
Set the DataSourceID of Telerik RadPanelBar to the ID of the XmlDataSource or choose data source from the smart tag:
- To map the Text, Value and NavigateUrl fields you can set the following properties to the corresponding attributes in the XML file:
| |
Copy Code |
|
DataTextField = "Text" DataNavigateUrlField= "Url" DataValueField= "Value" |
 |
The xml file for this particular example does not have a Value field, so you cannot actually populate the Value property of the items. |
- To map additional properties or overwrite already populated properties, you can subscribe to the ItemDataBound event and use the following method:
| C# |
Copy Code |
|
protected void RadPanelbar1_ItemDataBound(object sender, Telerik.WebControls.RadPanelbarEventArgs e) { //Set additional properties if (e.Item.Level > 0)//set tooltip only for child items { XmlElement element = (XmlElement)e.Item.DataItem; e.Item.ToolTip = "Read more about " + element.Attributes["Text"].Value; } } |
| VB |
Copy Code |
|
Protected Sub RadPanelbar1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.WebControls.RadPanelbarEventArgs) If e.Item.Level > 0 Then Dim element As XmlElement = DirectCast(e.Item.DataItem, XmlElement) e.Item.ToolTip = "Read more about " + element.Attributes("Text").Value End If End Sub |
See Also
|