Syncfusion TreeView控件CSS问题

发布于 2024-08-04 02:43:17 字数 4064 浏览 4 评论 0原文

我正在使用 Syncfusion TreeView 控件在网页上创建文件夹浏览器,我们的设计使用 CSS 来控制表格的布局,但我不知道如何阻止表格 CSS 影响 TreeView 的布局。

目前我的 Treeview 看起来像这样:

http://imagebin.org/63035

查看复选框和文本标签不像文件夹图标那样与树的左侧对齐。

我的 TreeView 定义如下:

           <div class="TreeViewTable">
                <cc1:TreeView ID="tvFileSystem" 
                    runat="server" 
                    Width="100%"
                    Height="500px"
                    CssClass="TreeView" 
                    ImageBaseURL="/images/treeIcons/"
                    DropChildCssClass="DropChildCss" 
                    EditNode="False" 
                    OnNodeExpanded="tvFileSystem_NodeExpanded"
                    OnNodeCheckChanged="tvFileSystem_NodeCheckChanged" 
                    AutoPostBackOnNodeCheckChanged="true" 
                    AutoCheckChildNodes="true">
                </cc1:TreeView>

                <asp:ListBox ID="listFiles" runat="server" Visible="false" Height="150px"></asp:ListBox>
            </div>

控件生成的 HTML 看起来像这样:

<div id="ctl00_mainPageContent_tvFileSystem_R2" class="tvItemRow" style="width:100%;">
<table cellspacing="0" cellpadding="0">
<tr>
    <td align="right" class="tvLineImgTD">
        <img src="/WebResource.axd" alt="" />
    </td>

    <td align="right" class="tvLineImgTD tvLineImgTD_1">
        <img src="/WebResource.axd" alt="" />
    </td>

    <td>
        <div id="ctl00_mainPageContent_tvFileSystem_I2" class="tvItem">
            <table cellspacing="0" cellpadding="0">
                <tr>
                    <td     id="ctl00_mainPageContent_tvFileSystem_I2_TI" class="tvImgCell">
                        <div id="ctl00_mainPageContent_tvFileSystem_I2_CI" class="tvImgCont"><img src="/images/treeIcons/folder.gif" id="ctl00_mainPageContent_tvFileSystem_I2_I" class="tvImg" alt="" />
                        </div>
                    </td>

                    <td id="ctl00_mainPageContent_tvFileSystem_I2_TB" class="tvCheckCell">
                        <input name="ctl00$mainPageContent$tvFileSystem_I2_B" type="checkbox" id="ctl00_mainPageContent_tvFileSystem_I2_B" class="tvCheck" onclick="_sfctl00_mainPageContent_tvFileSystem.OnClick(this, event)" onmousedown="_sfctl00_mainPageContent_tvFileSystem.OnMouseDown(this, event)" />
                    </td>

                    <td id="ctl00_mainPageContent_tvFileSystem_I2_TT" class="tvTextCell">
                        <table cellspacing="0" cellpadding="0">
                            <tr>
                                <td id="ctl00_mainPageContent_tvFileSystem_I2_CT" class="tvTextCont" style="white-space:nowrap;">
                                    1
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
    </td>
</tr>
</table>
</div>

我的 CSS 代码看起来像这样:


.TreeView 
{ 
  background-color:White;
  padding-top:4px; 
  padding-left:1px; 
  border: #7C7C94 1px solid; 
  cursor:default; 
  text-align: left;
}

.tvItemRow
{
    font-size:9pt;
    border: none;
    padding:0;
    width:auto;
    text-align:left;
}

/* TreeView Table Properties */

div.TreeViewTable
{
    border: none;
    border-bottom: none;
    padding:0;
    text-align:left;
}

div.TreeViewTable table {
    width:inherit;

}

div.TreeViewTable table tr th {
    border: none;
    padding: 0px;
    letter-spacing: 1px;
}

div.TreeViewTable table tr td {
    border: none;
    padding: 0px;
    letter-spacing: 1px;

}

div.TreeViewTable table tr.alt td {
    background-color:#EFEFEF;
}

任何有关应用于此页面以使元素排列的 CSS 代码的建议都会很好!

谢谢...

I am working with the Syncfusion TreeView control to create a folder browser on a web page, our design uses CSS to control the layout of tables, but I cannot figure out how I can stop the table CSS affecting the layout of the TreeView.

Currently my Treeview is looking like this:

http://imagebin.org/63035

See how the checkboxes and the text labels are not aligned to the left hand side of the tree like the folder icons are.

My TreeView is defined like this:

           <div class="TreeViewTable">
                <cc1:TreeView ID="tvFileSystem" 
                    runat="server" 
                    Width="100%"
                    Height="500px"
                    CssClass="TreeView" 
                    ImageBaseURL="/images/treeIcons/"
                    DropChildCssClass="DropChildCss" 
                    EditNode="False" 
                    OnNodeExpanded="tvFileSystem_NodeExpanded"
                    OnNodeCheckChanged="tvFileSystem_NodeCheckChanged" 
                    AutoPostBackOnNodeCheckChanged="true" 
                    AutoCheckChildNodes="true">
                </cc1:TreeView>

                <asp:ListBox ID="listFiles" runat="server" Visible="false" Height="150px"></asp:ListBox>
            </div>

The HTML generated by the control looks something like this:

<div id="ctl00_mainPageContent_tvFileSystem_R2" class="tvItemRow" style="width:100%;">
<table cellspacing="0" cellpadding="0">
<tr>
    <td align="right" class="tvLineImgTD">
        <img src="/WebResource.axd" alt="" />
    </td>

    <td align="right" class="tvLineImgTD tvLineImgTD_1">
        <img src="/WebResource.axd" alt="" />
    </td>

    <td>
        <div id="ctl00_mainPageContent_tvFileSystem_I2" class="tvItem">
            <table cellspacing="0" cellpadding="0">
                <tr>
                    <td     id="ctl00_mainPageContent_tvFileSystem_I2_TI" class="tvImgCell">
                        <div id="ctl00_mainPageContent_tvFileSystem_I2_CI" class="tvImgCont"><img src="/images/treeIcons/folder.gif" id="ctl00_mainPageContent_tvFileSystem_I2_I" class="tvImg" alt="" />
                        </div>
                    </td>

                    <td id="ctl00_mainPageContent_tvFileSystem_I2_TB" class="tvCheckCell">
                        <input name="ctl00$mainPageContent$tvFileSystem_I2_B" type="checkbox" id="ctl00_mainPageContent_tvFileSystem_I2_B" class="tvCheck" onclick="_sfctl00_mainPageContent_tvFileSystem.OnClick(this, event)" onmousedown="_sfctl00_mainPageContent_tvFileSystem.OnMouseDown(this, event)" />
                    </td>

                    <td id="ctl00_mainPageContent_tvFileSystem_I2_TT" class="tvTextCell">
                        <table cellspacing="0" cellpadding="0">
                            <tr>
                                <td id="ctl00_mainPageContent_tvFileSystem_I2_CT" class="tvTextCont" style="white-space:nowrap;">
                                    1
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
    </td>
</tr>
</table>
</div>

My CSS code is looking like this:


.TreeView 
{ 
  background-color:White;
  padding-top:4px; 
  padding-left:1px; 
  border: #7C7C94 1px solid; 
  cursor:default; 
  text-align: left;
}

.tvItemRow
{
    font-size:9pt;
    border: none;
    padding:0;
    width:auto;
    text-align:left;
}

/* TreeView Table Properties */

div.TreeViewTable
{
    border: none;
    border-bottom: none;
    padding:0;
    text-align:left;
}

div.TreeViewTable table {
    width:inherit;

}

div.TreeViewTable table tr th {
    border: none;
    padding: 0px;
    letter-spacing: 1px;
}

div.TreeViewTable table tr td {
    border: none;
    padding: 0px;
    letter-spacing: 1px;

}

div.TreeViewTable table tr.alt td {
    background-color:#EFEFEF;
}

Any suggestions as to what CSS code to apply to this page to get the elements lined up would be good!

Thanks...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浪荡不羁 2024-08-11 02:43:17

CSS 内容一定比您发布的内容还要多。显然有其他东西在干扰。我建议在 Firefox 上使用 Firebug 来检查哪些 CSS 应用于这些元素。很可能您的 css 类的范围比您预期的要广泛。

There has to be more CSS than what you've posted. Clearly something else is interfering. I recommend using Firebug on Firefox to check what CSS is being applied to those elements. Chances are you have a css class which has broader scope than you expect.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文