New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Xml String Binding

You can easily populate RadListBox from XML. To populate RadListBox from an XML file use the LoadContentFile method. To populate RadListBox from XML string use the LoadXml method.

C#

RadListBox1.LoadContentFile("ListBox.xml");
RadListBox2.LoadXml("<Items><Item Text=\"One\" /><Item Text=\"Two\" /></Items>");

VB.NET

RadListBox1.LoadContentFile("ListBox.xml")
RadListBox2.LoadXml("<Items><Item Text=\"One\" /><Item Text=\"Two\" /></Items>")
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • ListBox.xml
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="ListBox.Examples.PopulatingWithData.XmlStringBinding.DefaultCS" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-thin">
        <telerik:RadListBox RenderMode="Lightweight" runat="server" ID="RadListBox1" Width="300px" Height="200px">
        </telerik:RadListBox>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance