- Online Barcode Generator
- How To
- Buy Now
From the previous user manuals that you have provided, you might now already know that Kettic ListBox DLL component supports data binding with data source like SqlDataSource, LinqDataSource, etc. Moreover, in this guiding page, we will provide you with detailed guidance as well as complete sample codes for listbox data binding with XML.
XML, abbreviated from Extensible Markup Language, as the name suggests, is a markup language that can be easily read with both human eyes and machines. It defines a set of rules and is widely used for encoding documents in a variety of scenarios.
In the following sections, we provides two methods for you to either bind a listbox to XML data source or directly bind to an XML file by loading it with simply a few lines of Visual C# .NET programming.
Binding ListBox from XML DataSource
In this section, we will provide you with a simple demo for selecting an XML for listbox data source, please follow the procedure step by step to see how this works out.
PerListBox.DataSourceID = "XmlDataSource1";
Binding ListBox from XML File
If you do not like Kettic ListBox data binding by selecting DataSource, you can opt for Plan B to directly load and import an XML file from your local disk with just a few lines of Visual C# .NET programming codes.
The demo codes below indicate how you can load an XML file named ListBox.xml from your local file for data binding.
string xmlText = File.ReadAllText(
Please keep in mind that in order for both of the methods above to work, you need to have an XML file in advance which conforms to the format below:
<?xml version="1.0" encoding="utf-8" ?>
Let's take a look at how this works out. Below is a simple screenshot of ListBox after binding to an XML file.
ASP.NET AJAX UI Controls