473,702 Members | 2,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="ucCa tegories"
EnableTheming=" true"%>

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

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

Sub PopulateNode(By Val source As Object, ByVal e As
TreeNodeEventAr gs)

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

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

If (fullPath.Start sWith(rootDirec tory) = False) Then

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

Dim dirs() As String = Directory.GetDi rectories(fullP ath)

' Enumerate directories
Dim dir As String
For Each dir In dirs
Dim virtualDir As String = node.Value.Trim End(_slashArray ) &
"/" & Path.GetFileNam e(dir)

Dim newNode As TreeNode = New TreeNode(Path.G etFileName(dir) ,
virtualDir)
If (Directory.GetF iles(dir).Lengt h > 0 _
Or Directory.GetDi rectories(dir). Length > 0) Then
newNode.Populat eOnDemand = True
End If
node.ChildNodes .Add(newNode)
Next

' Enumerate files
Dim files() As String = Directory.GetFi les(fullPath)
Dim file As String
For Each file In files
Dim newNode As TreeNode = New TreeNode(Path.G etFileName(file ),
Path.GetFileNam e(file))
node.ChildNodes .Add(newNode)
Next

End Sub

</script>
<asp:Label cssclass="DarkC ontrol" ID = "lblLoginTi tle"
runat="Server" Text = "Categories "/>
<asp:TreeView Id="MyTree" SkinID="Arrows"
PathSeparator = "|"
OnTreeNodePopul ate="PopulateNo de"
ExpandDepth="1"
runat="server">
<Nodes>
<asp:TreeNode Text="Demos" PopulateOnDeman d="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="ucCa tegories"
EnableTheming=" true"%>

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

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

Sub PopulateNode(By Val source As Object, ByVal e As
TreeNodeEventAr gs)

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

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

If (fullPath.Start sWith(rootDirec tory) = False) Then

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

Dim dirs() As String = Directory.GetDi rectories(fullP ath)

' Enumerate directories
Dim dir As String
For Each dir In dirs
Dim virtualDir As String = node.Value.Trim End(_slashArray ) &
"/" & Path.GetFileNam e(dir)

Dim newNode As TreeNode = New TreeNode(Path.G etFileName(dir) ,
virtualDir)
If (Directory.GetF iles(dir).Lengt h > 0 _
Or Directory.GetDi rectories(dir). Length > 0) Then
newNode.Populat eOnDemand = True
End If
node.ChildNodes .Add(newNode)
Next

' Enumerate files
Dim files() As String = Directory.GetFi les(fullPath)
Dim file As String
For Each file In files
Dim newNode As TreeNode = New TreeNode(Path.G etFileName(file ),
Path.GetFileNam e(file))
node.ChildNodes .Add(newNode)
Next

End Sub

</script>
<asp:Label cssclass="DarkC ontrol" ID = "lblLoginTi tle"
runat="Server" Text = "Categories "/>
<asp:TreeView Id="MyTree" SkinID="Arrows"
PathSeparator = "|"
OnTreeNodePopul ate="PopulateNo de"
ExpandDepth="1"
runat="server">
<Nodes>
<asp:TreeNode Text="Demos" PopulateOnDeman d="true" />
</Nodes>
</asp:TreeView>


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

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

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s)
Page.Trace.IsEn abled = False
'Page.Trace.Wri te(Request.Path .Trim)

End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed 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="Standard Back"
style="width:16 0px;vertical-align:top;heigh t:700px">
<uc2:ucLogin2 ID="UcLogin1" runat="server"/>
<uc:ucCat ID="ucCat1" runat = "server"
EnableTheming=t rue />
<br />
</td>
<td valign="top" style="padding-left:20px;
padding-right:20px">
<asp:ContentPla ceHolder ID="ContentPlac eHolder1"
runat="server">
</asp:ContentPlac eHolder>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Feb 3 '06 #1
0 1711

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

Similar topics

7
3502
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 attribute. This works for the content pages, but it doesn't seem able to apply the styles to the top master page even though I did set the master head tag to runat server. Is this by design? If so, what is the best way to apply styles to the top...
1
1532
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 lack full functionality with CSS files. I have a theme set up. Inside that theme I can have 32 CSS files. Each file is for each page within that theme. Why? I find it easier having multiple small CSS files to work with rather than a few HUGE...
1
2292
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? Do I need to add the theme on the top of each page I create from this master page?
1
8000
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 run the app, the breakpoint is never hit. Of course my theme is not being applied. The above procedure works fine for any content page, but obviously doesn't work for my master page. So, how does one properly and programmatically set a theme...
0
1356
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 this GlobalPage which is working fine until the day I need to access the connectionString property in the GlobalPage from my ascx control. This is what I wrote : this.connectionString = ((Web.GlobalPage)this.Page.Master).ConnectionString;
4
1506
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 Visual studio 2005) as the master page, the images appear correctly. However, the images do not appear when I am using a container file within a directory. Do I need to use links that aren't relative to the master page so that any content page...
1
2051
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 effect. I saw this approach, I think, on a MSDN web site or blog: Config.vb Class where culture is set from profile value
0
1179
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 themes with skins. I really don't want to have to have 4 copies of the same master page just to get round the problem. The exact issue I'm having is this; in my app, when the user clicks
4
1618
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 set everything up. I created a Master page with three containers: header, content, footer. I created another page and put a few things in the content container. I set the theme option in the web.config. It appears to be applying the theme to the...
0
8738
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8652
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9086
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7829
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6575
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5907
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4412
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3104
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.