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

Binding to XML attributes?

1 Answer 52 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 13 Dec 2008, 01:24 AM
I've been able to databind to an xml file, but it's just displaying (and expanding) the node names...I'd like to display the Attributes instead...is that at all doable with the panelbar?

(sample)
<menu>
    <menuitem text="something" url="http://www.jujbjbjb.com" />
    <menuitem text="something2" url="http://www.jujbjbjb2.com" />
</menu>

Steve

1 Answer, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 18 Dec 2008, 03:25 PM
Hello Steve,

You can map additional properties using the ItemDataBound event:

protected void RadPanelBar1_ItemDataBound( object sender, Telerik.Web.UI.RadPanelBarEventArgs e)  
{  
  if (e.Item.Level > 0)//set tooltip only for child items  
  {            
      XmlElement element = (XmlElement)e.Item.DataItem;  
     e.Item.ToolTip = "Read more about " + element.Attributes["Text"].Value;  
  }  


All the best,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
PanelBar
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Paul
Telerik team
Share this question
or