asp.net TreeView prepends a GUID before ID in rendered HTML

marybelledoyle

New Member
Working in a .NET MVC project with aspx views. I have a partial view with this tree view:\[code\]<% TreeNode treeNode = Model.TreeNode; treeNode.SelectAction = TreeNodeSelectAction.None; tv1.Nodes.Add(treeNode); tv1.ExpandAll();%><form runat="server" id="form1"> <asp:TreeView runat="server" ID="tv1" ShowLines="true" EnableClientScript="true"> </asp:TreeView></form>\[/code\]But renders a div with an id prepended with a guid screwing up JavaScript code for expand/collapse (which means it doesn't work). Why?\[code\]<div id="46ea7e79-e351-46fa-93cc-597e7cfe280b_tv1"> <table style="border-width:0;" cellpadding="0" cellspacing="0"> <tbody><tr> <td><a id="46ea7e79-e351-46fa-93cc-597e7cfe280b_tv1n0" href="http://stackoverflow.com/questions/15643617/...">..</a></td> <td><span id="46ea7e79-e351-46fa-93cc-597e7cfe280b_tv1t0">...</span></td> </tr></tbody> ... </table></div>\[/code\]I am loading the partial view using Ajax and appending content to a div.
 
Back
Top