English 中文(简体)
2. 检查点后树木的变化地点
原标题:treeview change place after checking node

i have an asp.net treeView. on node exp以及ed i m binding child nodes for the exp以及ed node. But if i check the node 以及 than exp以及 it, the node 以及 all it s child change there position 以及 become like childs to the main node. when clicking again on the + it takes the right place. Any idea on how to solve it!!!

the树在更新中 小组

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <asp:TreeView ID="MyTreeView" runat="server" ImageSet="XPFileExplorer" NodeIndent="15"
    OnTreeNodeExp以及ed="MyTreeView_TreeNodeExp以及ed">
    <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
    <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="2px"
        NodeSpacing="0px" VerticalPadding="2px" />
    <ParentNodeStyle Font-Bold="False" />
    <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
        VerticalPadding="0px" />
</asp:TreeView>

        </ContentTemplate>
</asp:UpdatePanel>

from the code behind: on page load i have :

if (!this.IsPostBack)
            {
                this.MyTreeView.ShowCheckBoxes = TreeNodeTypes.All;
                this.MyTreeView.ShowLines = true;
                FillTree();//custom method just to fill the tree
            }

以及

    protected void MyTreeView_TreeNodeExp以及ed(object sender, TreeNodeEventArgs e)
    {
        TreeNode exp以及edNode = e.Node;

        if (exp以及edNode.Value != "-1" && exp以及edNode.Value == "-2")
        {
            //Some logic
        }

    }

预 收

最佳回答

this JavaScript function fix the tree :

function FixTreeview(treeView) {
            try {
                if (treeView) {
                    var treeLinks = treeView.getElementsByTagName("a");
                    var nodeCount = treeLinks.length;
                    for (i = 0; i < nodeCount; i++) {
                        if (treeLinks[i].firstChild.tagName) {
                            if (treeLinks[i].firstChild.tagName.toLowerCase() == "img") {
                                var currentToggleLink = treeLinks[i];
                                var childContainer = GetParentByTagName("table", currentToggleLink).nextSibling;
                                try {
                                    eval(currentToggleLink.href);
                                } catch (e) {
                                }
                            }
                        }
                    } 
                }
            } catch (e) {
            }
        }
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签