ASP.NET Web窗体 - TreeView节点脱位

时间:2018-03-23 22:38:15

标签: asp.net treeview nodes

TreeView(ASP)控件中的最后一个节点正显示在不同的位置,尽管分层逻辑仍然存在,我可以折叠节点。

TreeView嵌套在一个面板中,该面板位于<div>内。我已经为它扩展了足够的空间,甚至最大化TreeView大小,但同样的问题。现在经过几天的寻求帮助,因为我是网页设计的新手。此外,Scrollbar没有TreeView属性。 我正在使用。NET 3.5

进行编码

CODE:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="Genographic._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        #form1
        {
            height: 100%;
        }

        .bigDiv
        {
            width: 100%;
            height: 155px;
            background-color: red;
        }
        .imageDiv
        {
            width: 50%;
            height: 600px;
            background-color: white;
        }
        .labelDiv
        {
            width: 39%;
            height: 600px;
            background-color: control;
        }

        div > div
        {
            float: left;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="bigDiv">
        <asp:Panel ID="Panel_Menu" runat="server" BackColor="#336699" Width="100%" Height="155px">
            <center>
                <asp:Label ID="Label1" runat="server" Text="..."
                    Font-Size="X-Large" ForeColor="White"></asp:Label>
            </center>
            <br>
        </asp:Panel>
        <div class="imageDiv">
            <asp:Image ID="Image_Map" runat="server" Height="600px" Width="600px" ForeColor="#CCCCFF" />
        </div>
        <div class="labelDiv">
            <asp:Panel ID="Panel1" runat="server" Height="582px" Width="640px" Style="display: inline-block;">
                <br>
                <asp:Label ID="Label2" runat="server" Text="Level:      "></asp:Label>
                <br>
                <asp:TreeView ID="TreeView_Level" runat="server" PopulateNodesFromClient="False"
                    ShowLines="True" Height="300px" Width="251px">
                    <SelectedNodeStyle ForeColor="#FF6600" />
                </asp:TreeView>
                <br>
                <br>
                <br>
                <br>
                <br>
                <br>
                <br>
                <br>
                <br>
                <br>
                <asp:Label ID="Label3" runat="server" Text=""></asp:Label>
                <br>
                <asp:TreeView ID="TreeView_2" runat="server" ShowLines="True">
                    <SelectedNodeStyle ForeColor="#FF6600" />
                </asp:TreeView>
            </asp:Panel>
        </div>
    </div>
    </form>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

我使用absolute定位工作。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        #form1
        {
            height: 100%;
        }

        .bigDiv
        {
            width: 100%;
            height: 155px;
            background-color: red;
        }
        .imageDiv
        {
            position: absolute;
            top: 180px;
            left: 510px;
            width: 600px;
            height: 100%;
            background-color: green;
        }
        .labelDiv
        {
            position:absolute;
            top: 180px;
            left: 5px;
            width: 500px;
            height: 100%;
            background-color: yellow;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="bigDiv" style="background-color: #3366CC">
        <center>
            <asp:Label ID="Label1" runat="server" Text="..."
                Font-Size="X-Large" ForeColor="White"></asp:Label>
        </center>
        <br>
        <div class="imageDiv">
            <asp:Image ID="Image_Map" runat="server" ForeColor="#CCCCFF" />
        </div>
        <div class="labelDiv">
            <asp:Label ID="Label2" runat="server" Text="Level:"></asp:Label>
            <br>
            <asp:TreeView ID="TreeView_Level" runat="server" PopulateNodesFromClient="False"
                ShowLines="True" Width="416px">
                <SelectedNodeStyle ForeColor="#FF6600" />
            </asp:TreeView>
            <br>
            <br>
            <asp:Label ID="Label3" runat="server" Text="...:"></asp:Label>
            <br>
            <asp:TreeView ID="TreeView_H" runat="server" ShowLines="True">
                <SelectedNodeStyle ForeColor="#FF6600" />
            </asp:TreeView>
        </div>
    </div>
    </form>
</body>
</html>