This is a migrated thread and some comments may be shown as answers.

combobox bind to xml but xml category

2 Answers 28 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
salih asked on 19 Jan 2009, 11:56 AM

Hi my name is salih Sorry I'm bad English 

sample combobox XmlStringBinding but xml category binding 

this telerik xml 

<?xml version="1.0" encoding="utf-8" ?> 
<Item Text="New York" Value="1" />
<Item Text="Paris" Value="2" />
<Item Text="London" Value="3" />
<Item Text="Oslo" Value="4" />
<Item Text="Sofia" Value="5" />
<Item Text="Liverpool" Value="6" />
<Item Text="Seattle" Value="7" />
<Item Text="San Francisco" Value="8" />
<Item Text="Boston" Value="9" />
<Item Text="Miami" Value="10" />
<Item Text="Denver" Value="11" />
<Item Text="Dallas" Value="12" />
<Item Text="Madrid" Value="13" />
<Item Text="Barcelona" Value="14" />
<Item Text="Amsterdam" Value="15" />
<Item Text="Moscow" Value="16" />
<Item Text="Brussels" Value="17" />
<Item Text="Bonn" Value="18" />
<Item Text="Dublin" Value="19" />
<Item Text="St.Paul" Value="20" />
<Item Text="keci" Value="21" />
<Odasayisi text="1+1" value="11"/>

Thim I'm xml 

<?xml version="1.0" encoding="utf-8" ?>
<make name="Acura">
<model name="Integra">
<color name="Green" />
<color name="Sea Green" />
<color name="Pale Green" />
<model name="RL">
<color name="Red" />
<color name="Bright Red" />
<model name="TL">
<color name="Teal" />
<color name="Dark Teal" />
<make name="Audi" value="Audi (value)">
<model name="A4" value="A4 (value)">
<color name="Azure" value="Azure (value)" />
<color name="Light Azure" value="Light Azure (value)" />
<color name="Dark Azure" value="Dark Azure (value)" />
<model name="S4" value="S4 (value)">
<color name="Silver" value="Silver (value)" />
<color name="Metallic" value="Metallic (value)" />
<model name="A6" value="A6 (value)">
<color name="Cyan" value="Cyan (value)" />
<make name="BMW" value="BMW (value)">
<model name="3 series" value="3 series (value)">
<color name="Blue" value="Blue (value)" />
<color name="Sky Blue" value="Sky Blue (value)" />
<color name="Racing Blue" value="Racing Blue (value)" />
<model name="5 series" value="5 series (value)">
<color name="Yellow" value="Yellow (value)" />
<color name="Banana" value="Banana (value)" />
<model name="7 series" value="7 series (value)">
<color name="Brown" value="Brown (value)" />

I'm Not Combobox Binding Erorr 

Combobox1 add    <model name="5 series" value="5 series (value)">

combobox2 add  <color name="Yellow" value="Yellow (value)" />

help me please

2 Answers, 1 is accepted

Sort by
Atanas Korchev
Telerik team
answered on 19 Jan 2009, 03:38 PM
Hello salih,

RadComboBox's built-in XML support can use only the first form of XML (Items/Item). Your XML is in a custom (unsupported) format. You need to parse it using either XmlDocument or XmlReader and create RadComboBox items on the fly. Here is some sample code:

XmlDocument xmlDoc = new XmlDocument();
//Load somehow your xml in the xmlDoc

foreach (XmlNode node in xmlDoc.DocumentElement.ChildNodes)
    RadComboBoxItem item = new RadComboBoxItem();
    item.Text = node.Attributes["name"].Value;

the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Top achievements
Rank 1
answered on 19 Jan 2009, 03:53 PM

thak you telerik :)


one sample please 

Asked by
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Top achievements
Rank 1
Share this question