ListBox - Xml String Binding

  • Amsterdam
  • Barcelona
  • Bonn
  • Boston
  • Brussels
  • Dallas
  • Denver
  • Dublin
  • Liverpool
  • London
  • Madrid
  • Miami
  • Moscow
  • New York
  • Oslo
  • Paris
  • San Francisco
  • Seattle
  • Sofia
  • St.Paul
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

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 PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<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>

Find Assistance

Help Us Improve

Was this example helpful?