473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Binding ASCX in Master Page to theme

Hello all,

I'm very new to all of this.
I have a theme and a skin (the standard ones).
I have a standard master page which is holding a custom ascx which has
a treeview in it.
Can someone please point me in the right direction to bind a theme to
the treeview?
The 'theme' tag is on the <%@ page %> directive... however neither my
master page or ASCX files use this. They use <%Master%> and
%@control%>.
Thanks very much in advance,
Damien Sawyer

PS - ASCX and master page included below (from sample)

<%@ Control Language="VB" ClassName="ucCategories"
EnableTheming="true"%>

<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">

Shared ReadOnly _slashArray() As Char = {"/"}

Sub PopulateNode(ByVal source As Object, ByVal e As
TreeNodeEventArgs)

Dim node As TreeNode = e.Node
If (node.Value = "Demos") Then
node.Value = "~/"
End If

Dim rootDirectory As String = Request.MapPath("~/",
Request.ApplicationPath, False)
Dim fullPath As String = Request.MapPath(node.Value,
Request.ApplicationPath, False)

If (fullPath.StartsWith(rootDirectory) = False) Then

' Mitigate against spoofed callback arguments
' Requested directory is not under root directory
Return
End If

Dim dirs() As String = Directory.GetDirectories(fullPath)

' Enumerate directories
Dim dir As String
For Each dir In dirs
Dim virtualDir As String = node.Value.TrimEnd(_slashArray) &
"/" & Path.GetFileName(dir)

Dim newNode As TreeNode = New TreeNode(Path.GetFileName(dir),
virtualDir)
If (Directory.GetFiles(dir).Length > 0 _
Or Directory.GetDirectories(dir).Length > 0) Then
newNode.PopulateOnDemand = True
End If
node.ChildNodes.Add(newNode)
Next

' Enumerate files
Dim files() As String = Directory.GetFiles(fullPath)
Dim file As String
For Each file In files
Dim newNode As TreeNode = New TreeNode(Path.GetFileName(file),
Path.GetFileName(file))
node.ChildNodes.Add(newNode)
Next

End Sub

</script>
<asp:Label cssclass="DarkControl" ID = "lblLoginTitle"
runat="Server" Text = "Categories"/>
<asp:TreeView Id="MyTree" SkinID="Arrows"
PathSeparator = "|"
OnTreeNodePopulate="PopulateNode"
ExpandDepth="1"
runat="server">
<Nodes>
<asp:TreeNode Text="Demos" PopulateOnDemand="true" />
</Nodes>
</asp:TreeView>


---------------------------------

Hello all,

I'm very new to all of this.
I have a theme and a skin (the standard ones).
I have a standard master page which is holding a custom ascx which has
a treeview in it.
Can someone please point me in the right direction to bind a theme to
the treeview?
The 'theme' tag is on the <%@ page %> directive... however neither my
master page or ASCX files use this. They use <%Master%> and
%@control%>.
Thanks very much in advance,
Damien Sawyer

PS - ASCX and master page included below (from sample)

<%@ Control Language="VB" ClassName="ucCategories"
EnableTheming="true"%>

<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">

Shared ReadOnly _slashArray() As Char = {"/"}

Sub PopulateNode(ByVal source As Object, ByVal e As
TreeNodeEventArgs)

Dim node As TreeNode = e.Node
If (node.Value = "Demos") Then
node.Value = "~/"
End If

Dim rootDirectory As String = Request.MapPath("~/",
Request.ApplicationPath, False)
Dim fullPath As String = Request.MapPath(node.Value,
Request.ApplicationPath, False)

If (fullPath.StartsWith(rootDirectory) = False) Then

' Mitigate against spoofed callback arguments
' Requested directory is not under root directory
Return
End If

Dim dirs() As String = Directory.GetDirectories(fullPath)

' Enumerate directories
Dim dir As String
For Each dir In dirs
Dim virtualDir As String = node.Value.TrimEnd(_slashArray) &
"/" & Path.GetFileName(dir)

Dim newNode As TreeNode = New TreeNode(Path.GetFileName(dir),
virtualDir)
If (Directory.GetFiles(dir).Length > 0 _
Or Directory.GetDirectories(dir).Length > 0) Then
newNode.PopulateOnDemand = True
End If
node.ChildNodes.Add(newNode)
Next

' Enumerate files
Dim files() As String = Directory.GetFiles(fullPath)
Dim file As String
For Each file In files
Dim newNode As TreeNode = New TreeNode(Path.GetFileName(file),
Path.GetFileName(file))
node.ChildNodes.Add(newNode)
Next

End Sub

</script>
<asp:Label cssclass="DarkControl" ID = "lblLoginTitle"
runat="Server" Text = "Categories"/>
<asp:TreeView Id="MyTree" SkinID="Arrows"
PathSeparator = "|"
OnTreeNodePopulate="PopulateNode"
ExpandDepth="1"
runat="server">
<Nodes>
<asp:TreeNode Text="Demos" PopulateOnDemand="true" />
</Nodes>
</asp:TreeView>


---------------------------------
<%@ Master Language="VB" %>
<%@ Register Src="../UserControls/ucLogin2.ascx" TagName="ucLogin2"
TagPrefix="uc2" %>
<%@ Register Src="../UserControls/ucCategories.ascx" TagName="ucCat"
TagPrefix="uc" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
Page.Trace.IsEnabled = False
'Page.Trace.Write(Request.Path.Trim)

End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="../css/noteesky.css" rel="stylesheet" type="text/css"
/>
<link href="../CSS/Toolttip.css" rel="stylesheet" type="text/css"
/>
<script type="text/javascript"
src="../Scripts/Tooltip.js"></script>

</head>
<body>
<form id="form1" runat="server">
<div>
&nbsp;<table border="0" cellpadding="0" cellspacing="0"
style="margin: 0px auto;
width: 100%; height: 100%">
<tr>
<td colspan="2" style="text-align:center;
vertical-align:middle ">
&nbsp;</td>

</tr>
<tr>
<td class="StandardBack"
style="width:160px;vertical-align:top;height:700px">
<uc2:ucLogin2 ID="UcLogin1" runat="server"/>
<uc:ucCat ID="ucCat1" runat = "server"
EnableTheming=true />
<br />
</td>
<td valign="top" style="padding-left:20px;
padding-right:20px">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Feb 3 '06 #1
0 1699

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: sasquatch | last post by:
Hi, I've a a site with nested master pages and content pages. I tried using a theme with a stylesheet in the app_themes directory referencing it in the web.config file from a pages tag theme...
1
by: Ryan Ternier | last post by:
I have just started playing around with ASP.NET 2.0 and have a few questions I couldn't get answers to on the net. If anyone could help me with these it'd be awesome. --- Themes - THey seem to...
1
by: Miguel Dias Moura | last post by:
Hello, I am creating a master page for a web site. All pages created from this master page will use the same theme. However I am not able to add the theme in my master page. Why is that? ...
1
by: Joey | last post by:
Hello, I have tried to programmatically set the theme for my master page by putting code in a "Page_PreInit" fuction in the master page's code behind. However, when I set a breakpoint there and...
0
by: xs | last post by:
I have a master page which has a class name "GlobalPage" created in Web namespace. I created a string property called connectionString in this GlobalPage class. I have a ascx control loaded in...
4
by: JJ | last post by:
My master page contains various graphics that are referenced from the images folder. As long as the container pages are at the same level (ie. the top level looking at the solution explorer in...
1
by: shapper | last post by:
Hello, I am creating a web site with Nested Master pages. I also need to have a class where the culture is set. When the culture is changed by the user the page refreshes and the change takes...
0
by: luminousc | last post by:
Hi guys, I've got a really annoying bug that I can't find a way around. I'm trying to rebuild our group's intranet. Which comprises of 4 individual companies, hence I want to use 4 different...
4
by: Stacey Levine | last post by:
I am trying to develop an intranet site and thought I would use Master Pages and themes. I found the the MS templates at http://msdn2.microsoft.com/en-us/asp.net/aa336613.aspx and was trying to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.