C# , ASP.Net 3.5, Infragistics 11.1
I have a WebDataTree built without using a webhierarchicaldatasource and I would like to use a template for the nodes to change the way the image and text are displayed. I've used the smart tag to create a template, but I'm unable to use the <%# (Eval("Text")) %> a tags to display data because I'm not binding a data source. If I use a template similar to the one below, how to I set node values,imageurl, and text in C# code behind? I've tried accessing the controls to set values but can't seem to figure out how to get to them.
<ig:WebDataTree ID="wdtTree" runat="server" Height="600px" Width="400px" OnNodePopulate="wdtTree_TreeNodePopulate" EnableConnectorLines="True" OnNodeDropped="wdtTree_OnNodeDropped"> <DragDropSettings EnableDragDrop="True"> </DragDropSettings> <Templates> <ig:ItemTemplate ID="wdtTreeTemplate1" runat="server" TemplateID="NodesTemplate"> <Template> <asp:Image runat="server" ID="NodeImage" /> <asp:Label runat="server" ID="lblNodeText" Text=""></asp:Label> </Template> </ig:ItemTemplate> </Templates> </ig:WebDataTree>
Thanks,
Jon
When you say you are binding data programmatically, does that mean that you are not using DataSource, but are rather manually adding nodes to the Nodes collections?
If so, you don't need to use templates at all. As you are adding the node, just set the node Text property to whatever you want the HTML markup to be.