Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
my xml

XML
<items>
<

i want to bind the item 2 name in list box

my c#
<pre lang="c#">
private void cmbecg_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cmbecg.SelectedIndex == 1)
            {
                XmlDocument xdoc = new XmlDocument();
                xdoc.Load(@"F:\tuner4tronics\t4tdevicedescriptor\t4tdevicedescriptor\ecgdiscription.xml");
                XmlNodeList ecglistfeatures = xdoc.SelectNodes("items/item/features/name");
                if (lst1.Items.Count == 0)
                {
                    foreach (XmlNode name in ecglistfeatures)
                    {
                            lst1.Items.Add(name.InnerText.Trim());
                    }
                }
            }
            else if (cmbecg.SelectedIndex == 2) !!!!!!here i want to bind item 2 name !!!!!!!
            {
                lst1.Items.Clear();
                XmlDocument xdoc = new XmlDocument();
                xdoc.Load(@"F:\tuner4tronics\t4tdevicedescriptor\t4tdevicedescriptor\ecgdiscription.xml");
                XmlNodeList ecglistfeatures = xdoc.SelectNodes("items/item/attribute[id='2']/name");
                if (lst1.Items.Count == 0)
                {
                    foreach (XmlNode name in ecglistfeatures)
                    {
                        lst1.Items.Add(name.InnerText.Trim());
                    }
                }
            }
           
        }
Posted
Updated 1-Dec-13 22:16pm
v3

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900