Binding ASCX in Master Page to theme

D

damiensawyer

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,039
Messages
2,570,376
Members
47,026
Latest member
TishaMadri

Latest Threads

Top