Hello, I'm having a problem with the WebDataTree. It looks like when I use a template and perform a postback, my data is no longer bound. I have confirmed that when a template is not used, the data stays bound. I would suspect that I’m doing something wrong.
Here's a simple sample of what I’m trying in my application.
The only thing happening in the code behind is in the WebDataTree1_NodeBound event where I assign the node a template.
Anyone see any problems here?
<ig:WebDataTree EnableViewState="true" ID="WebDataTree1" runat="server" OnNodeBound="WebDataTree1_NodeBound" DataSourceID="WebHierarchicalDataSource1" > <Templates> <ig:ItemTemplate ID="WebDataTree1Template1" runat="server" TemplateID="Participant"> <Template> <%# (Eval("FullName"))%> </Template> </ig:ItemTemplate> </Templates> <DataBindings> <ig:DataTreeNodeBinding DataMember="sdsParticipant_DefaultView" /> </DataBindings></ig:WebDataTree>
<ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server" > <DataViews> <ig:DataView ID="sdsParticipant_DefaultView" DataMember="DefaultView" DataSourceID="sdsParticipant" /> </DataViews></ig:WebHierarchicalDataSource>
<asp:SqlDataSource ID="sdsParticipant" runat="server" ConnectionString="<%$ ConnectionStrings:usWorkBaseConnectionString %>" SelectCommand="SELECT [FirstName] + ' ' + [LastName] as FullName, * FROM [Participants] WHERE [LastName] = 'Abaray'"></asp:SqlDataSource>
<asp:Button Text="Postback" runat="server" />
Any help would be much appreciated.
Wonderful Duane, that sure did work. You’re a life saver. Thank you for the response.
Hello,
Setting the datasource at every postback should work for this.
In example you can put the code in the Page_Load event:WebDataTree1.DataSource = WebHierarchicalDataSource1.DataSource;
Sincerely,Duane HoytDeveloper Support EngineerInfragisticshttp://ko.infragistics.com/support