Skip to main content

TabControl - Automatic Data Binding to an XML file

  • 2 minutes to read

This sample demonstrates how to bind the ASPxTabControl to data without manually setting the control's data-related properties.

The ASPxTabControl's data source is set to an XmlDataSource component that is used to retrieve data from an XML file. The XmlDataSource's XPath property is defined explicitly.

Based on the source data, the ASPxTabControl populates its Tabs collection with automatically created Tab objects. Tab object characteristics (such as text, image, navigate location, tooltip text, etc.) are obtained from the XML file's node attributes.This example demonstrates the ASPxTabControl's ability to automatically retrieve tab characteristics from node attributes whose names coincide with property names of a Tab object. For this purpose, node attributes are named asActiveTabImageUrl,Name,NavigateUrl, TabImageUrl, Text and ToolTip in this demo. Note that the name match is not case sensitive.

View Example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e) {