the_sleeper
asked on
ASP.Net Newbie: Question on Treeview Control Styles
Aiight, I give up. Jeez, I just started ASP.NET and already a weird issue.
Im simply trying to manipulate the styles for the tree view control. That is, the Selected Style (SelectedNodeStyle) and the Hover Style (HoverNodeStyle). Yet nothing changes on select or on hover: the code (VB) fo rmy master page template.
Please advise...
========== master page template===============
<%@ Master Language="VB" CodeFile="MainTemplate.mas ter.vb" Inherits="MainTemplate" %>
<!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] :: X-TEch</title>
<link href="mainTemplateStyles.c ss" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/scripts/core-scripts .js" id="coreSripts" />
</head>
<body>
<form id="mainContainerForm" runat="server">
<div id="mainDivContainer">
<table id="mainTblContainer" border="0" cellpadding="0" cellspacing="0" width="100%">
<!-- Header -->
<tr>
<td align="center" valign="top" colspan="2"><h1>header</h1 ></td>
</tr>
<!-- breadcrumb -->
<tr>
<td align="center" valign="top" colspan="2"><p>breadcrumb control</p></td>
</tr>
<tr>
<!-- left nav -->
<td align="left" valign="top" style="width: 144px">
<div id="leftNavDiv">
<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataS ource1"
ShowLines="True"
Width="236px"
BackColor="Transparent">
<HoverNodeStyle BackColor="GreenYellow" />
<SelectedNodeStyle BackColor="#404000" />
</asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
</td>
<!-- main content control -->
<td align="left" valign="top">
<div id="MainContentPlacerHolde rDiv">
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server"></asp:conte ntplacehol der>
</div>
</td>
</tr>
<!-- footer -->
<tr>
<td align="center" valign="top" colspan="2"><h1>footer</h1 ></td>
</tr>
</table>
</div>
</form>
</body>
</html>
Im simply trying to manipulate the styles for the tree view control. That is, the Selected Style (SelectedNodeStyle) and the Hover Style (HoverNodeStyle). Yet nothing changes on select or on hover: the code (VB) fo rmy master page template.
Please advise...
========== master page template===============
<%@ Master Language="VB" CodeFile="MainTemplate.mas
<!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] :: X-TEch</title>
<link href="mainTemplateStyles.c
<script type="text/javascript" src="/scripts/core-scripts
</head>
<body>
<form id="mainContainerForm" runat="server">
<div id="mainDivContainer">
<table id="mainTblContainer" border="0" cellpadding="0" cellspacing="0" width="100%">
<!-- Header -->
<tr>
<td align="center" valign="top" colspan="2"><h1>header</h1
</tr>
<!-- breadcrumb -->
<tr>
<td align="center" valign="top" colspan="2"><p>breadcrumb control</p></td>
</tr>
<tr>
<!-- left nav -->
<td align="left" valign="top" style="width: 144px">
<div id="leftNavDiv">
<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataS
ShowLines="True"
Width="236px"
BackColor="Transparent">
<HoverNodeStyle BackColor="GreenYellow" />
<SelectedNodeStyle BackColor="#404000" />
</asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
</td>
<!-- main content control -->
<td align="left" valign="top">
<div id="MainContentPlacerHolde
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server"></asp:conte
</div>
</td>
</tr>
<!-- footer -->
<tr>
<td align="center" valign="top" colspan="2"><h1>footer</h1
</tr>
</table>
</div>
</form>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just for testing purposes create a new aspx page and paste this declation then run the page
<asp:TreeView ID="TreeView1" runat="server" BackColor="transparent">
<HoverNodeStyle BackColor="Black" />
<SelectedNodeStyle BackColor="Red" />
<Nodes>
<asp:TreeNode Text="Node1" Value="Parent">
<asp:TreeNode Text="Child1" Value="Child1"></asp:TreeN ode>
<asp:TreeNode Text="Child2" Value="Child2"></asp:TreeN ode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
let me know what you get.
Sammy
<asp:TreeView ID="TreeView1" runat="server" BackColor="transparent">
<HoverNodeStyle BackColor="Black" />
<SelectedNodeStyle BackColor="Red" />
<Nodes>
<asp:TreeNode Text="Node1" Value="Parent">
<asp:TreeNode Text="Child1" Value="Child1"></asp:TreeN
<asp:TreeNode Text="Child2" Value="Child2"></asp:TreeN
</asp:TreeNode>
</Nodes>
</asp:TreeView>
let me know what you get.
Sammy
ASKER
Works as coded, BackColor IS black ON hover.
...what gives..
...what gives..
ASKER
However, that example was not in a master page. I added your code to the masterpage and got the same issue (no hover css)
ASKER
I got it to work, but the cure is stranger than the disease, so to speak.
I had to remove <script type="text/javascript" src="/scripts/core-scripts .js" id="coreSripts" /> from the head in the master page.
Then everything worked as predicted.
So... whats up with that?
I had to remove <script type="text/javascript" src="/scripts/core-scripts
Then everything worked as predicted.
So... whats up with that?
whats in the script?
I just ran the same code using a master page and it ran fine with the expected results
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestMaster.aspx. cs" Inherits="TestMaster" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server">
<HoverNodeStyle BackColor="Black" />
<SelectedNodeStyle BackColor="Red" />
<Nodes>
<asp:TreeNode Text="Parent Node" Value="Parent Node">
<asp:TreeNode Text="Child One" Value="Child One">
<asp:TreeNode Text="Child Two" Value="Child Two"></asp:TreeNode>
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestMaster.aspx.
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server">
<HoverNodeStyle BackColor="Black" />
<SelectedNodeStyle BackColor="Red" />
<Nodes>
<asp:TreeNode Text="Parent Node" Value="Parent Node">
<asp:TreeNode Text="Child One" Value="Child One">
<asp:TreeNode Text="Child Two" Value="Child Two"></asp:TreeNode>
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>
</form>
</body>
</html>
ASKER
@sammy1971 >> whats in the script?
nothing. absolutely nothing. it's just...there. (for when I will eventually write something, which is inevitable)
@sammy1971 >> I just ran the same code using a master page and it ran fine with the expected results
is there a script with a link to an external .js file in the in the <head> section of the master page?
nothing. absolutely nothing. it's just...there. (for when I will eventually write something, which is inevitable)
@sammy1971 >> I just ran the same code using a master page and it ran fine with the expected results
is there a script with a link to an external .js file in the in the <head> section of the master page?
ASKER
update:
I changed: <script type="text/javascript" src="/scripts/core-scripts .js" id="coreSripts" />
to this: <script type="text/javascript" src="/scripts/core-scripts .js" id="coreSripts"><script>
Seems life I must have the </script> tag
now everything works...
so whats the deal, MUST i use closing script tags in the Master Pages?
I changed: <script type="text/javascript" src="/scripts/core-scripts
to this: <script type="text/javascript" src="/scripts/core-scripts
Seems life I must have the </script> tag
now everything works...
so whats the deal, MUST i use closing script tags in the Master Pages?
looks like it.
something to remember I guess.
Glad it worked out for you
something to remember I guess.
Glad it worked out for you
ASKER
points awarded for your efforts..
ASKER
Tried that, no luck. Still no hover styles. Permissions Issue, Maybe? Some Errant Server Setting?
Im running
IIS 5.1 Locally
WinXP SP2
Visual Studio 2005 (ver 8.0.5)