2011-11-09 8 views
0

こんにちはすべて私はナビゲートしていないときにうまく動作するtreeviewのselectednodestyleを適用しました。しかし、ナビゲートすると、ツリービューの選択されたノードに適用された色を見ることができません。ここでは、マスターページで自分のデザインがあるmasterpageでTreeviewをナビゲート中にSelectedNodeStyleを維持する

<asp:TreeView ID="TreeViewCategories" runat="server" ExpandDepth="0" Style="min-height: 200px; 
     max-height: 500px;" NodeIndent="0" LeafNodeStyle-CssClass="LeafNodesStyle" CssClass="TreeView" 
     NodeStyle-CssClass="NodeStyle" ParentNodeStyle-CssClass="ParentNodeStyle" RootNodeStyle-CssClass="RootNodeStyle" 
     SelectedNodeStyle-CssClass="SelectedNodeStyle" LeafNodeStyle-Width="100%" NodeStyle-Width="100%" 
     ParentNodeStyle-Width="100%" RootNodeStyle-Width="100%" Font-Size="12pt"> 
     <Nodes> 
      <asp:TreeNode Text="All Items" NavigateUrl="~/Default3.aspx" SelectAction="SelectExpand" 
       Value="All Items"> 
       <asp:TreeNode Text="Hello" Value="Hello"></asp:TreeNode> 
      </asp:TreeNode> 
     </Nodes> 
    </asp:TreeView> 

これは私のcss

<style type="text/css"> 
    .TreeView 
    { 
     border-bottom: 1px dotted #B2B2B2 !important; 
    } 
    .TreeView div 
    { 
     margin-left: 5px; 
    } 
    .TreeView table 
    { 
     border-top: 1px dotted #B2B2B2 !important; 
    } 
    .TreeView div table 
    { 
     border-bottom: none !important; 
     border-top: none !important; 
    } 
    .TreeView table td 
    { 
     padding: 2px 0; 
    } 
    .LeafNodesStyle 
    { 
    } 
    .RootNodeStyle 
    { 
    } 
    /* ALL ELEMENTS */.NodeStyle 
    { 
    } 
    .ParentNodeStyle 
    { 
     /*background:yellow;*/ 
    } 
    .SelectedNodeStyle 
    { 
     font-weight: bold; 
     color: #6799D1; 
     display: block; 
     padding: 2px 0 2px 3px; 
    } 
</style> 

ですが、私はいずれかが私に

+0

すべてのヘルプ – Dotnet

答えて

1

を助けることができるページに移動した後、選択したノードの色を適用することができませんあなたのコードはうまくいきます。選択したテキストがの太字のになったことに気がつくと、

テキストの色が変更されている場合は、問題があります。あなたがソースコードを見たい場合は、だけでなく、SelectedNodeStyle CSSスタイルは、アイテムに適用されるが、これらも

NodeStyle FooterContent_TreeViewCategories_2 LeafNodesStyle FooterContent_TreeViewCategories_8 SelectedNodeStyle FooterContent_TreeViewCategories_10 

は私が取るために、色の変化のためにあなたのCSSの色に重要ないくつかを!置くことをお勧め効果。

.SelectedNodeStyle 
{ 
    font-weight: bold; 
    color: #6799D1 !important; 
    display: block; 
    padding: 2px 0 2px 3px; 
} 
+0

はどこ私はちょうど追加 – Dotnet

+0

私の要件ごとに出て仕事をするために、今すぐ変更する必要がありますしてください!あなたのSelectedNodeStyleのCSSクラスに重要。上記を参照。 –

関連する問題