Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 8th, 2007, 01:03 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP.NET and XML/XSLT

I'm creating a site that's going to use the ASP.NET Master Page Control to transform XML/XSLT data into the content section of an ASP.NET form. I've already created the basic setup for the site (code below), and some of the content, but I have a few questions/concerns about this method:

What I don't like about the Master Page Control so far is the size of the pages. I haven't even put any content on the main section of the page, and it's already 31043 bytes in size. What are some steps that I can take to optimize this site (i.e. caching)? Also, how should I go about creating and processing a form within a transformed page using the Master Page control? Should I use XForms (like http://www.w3schools.com/xforms/default.asp) or dynamic ASP.NET server controls within XML (like http://www.dnzone.com/ShowDetail.asp?NewsId=151)?

MASTER PAGE - NavMaster.master
Code:
<%@ Master Language="VB" CodeFile="NavMaster.master.vb" Inherits="NavMaster" Debug="True" %>

<!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>Nav MasterPage</title>
    <link rel="stylesheet" type="text/css" media="screen" href="~/docs/css/screen.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div id="wrapper">

        <div id="tabs">
            <asp:Menu id="Menu2" runat="server" 
                StaticDisplayLevels="1" 
                StaticSubMenuIndent="1"
                StaticMenuStyle-VerticalPadding="0"
                Orientation="Horizontal"
                StaticEnableDefaultPopOutImage="False"
                StaticMenuItemStyle-HorizontalPadding="0" StaticMenuStyle-HorizontalPadding="0">
                <Items>
                    <asp:MenuItem NavigateUrl="default.aspx" ImageUrl="~/images/gif/tab1_active.gif" />
                    <asp:MenuItem NavigateUrl="~/aboutus/aboutus.aspx" ImageUrl="~/images/gif/tab2_active.gif" />
                    <asp:MenuItem NavigateUrl="~/depts/depts.aspx" ImageUrl="~/images/gif/tab3_active.gif" />
                </Items>
            </asp:Menu>
        </div>

        <div id="screenleft">
            <asp:contentplaceholder 
                id="LeftColumn" 
                runat="server" />
        </div>

        <div id="content">

            <h1><asp:label id="lblPageTitle" runat="server" /></h1>
            <br />


            <asp:SiteMapPath 
                id="SiteMapPath1" 
                Runat="Server" />
            <br /><br />

            <asp:contentplaceholder 
                id="ContentColumn" 
                runat="server" />
        </div>

        <div id="screenright">
            <asp:ContentPlaceHolder 
                id="RightColumn" 
                runat="server">
                <asp:Image
                    ID="Ad1" 
                    ImageUrl="~/images/gif/ad1.gif"
                    Runat="Server" />
                <br />
                <asp:Image
                    ID="Ad2"  
                    ImageUrl="~/images/gif/ad2.gif"
                    Runat="Server" />
            </asp:ContentPlaceHolder>
        </div>

        <div id="screenfooter">
            This is the footer section
        </div>
    </div>
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
    </form>
</body>
</html>
SITEMAP - web.sitemap
Code:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
  <siteMapNode url="~/default.aspx" title="Home" description="Home">
    <siteMapNode id="aboutus" url="~/aboutus/aboutus.aspx" title="About Us" description="About Us">
    </siteMapNode>
    <siteMapNode url="~/depts/depts.aspx" title="Departments" description="Departments">
    </siteMapNode>
  </siteMapNode>
</siteMap>
ASP.NET PAGE - default.aspx
Code:
<%@ Page Language="VB" MasterPageFile="~/NavMaster.master" AutoEventWireup="false" CodeFile="default.aspx.vb" Inherits="_default" title="Home Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LeftColumn" Runat="Server">

<div id="screenleftnav">
    <div class="leftheader">About Us</div>
    [list]
        <li><a href="">Button 1</a></li>
        <li><a href="">Button 2</a></li>
        <li><a href="">Button 3</a></li>
        <li><a href="">more...</a></li>
    </ul>
    <div class="leftheader">Departments</div>
    [list]
        <li><a href="">Button 4</a></li>
        <li><a href="">Button 5</a></li>
        <li><a href="">Button 6</a></li>
        <li><a href="">more...</a></li>
    </ul>
    <br />
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentColumn" Runat="Server">
    This is the main content section. This is where the XML/XSLT transformation will take place.
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightColumn" Runat="Server">
<div id="screenright">
    This is the right content section.
</div>
</asp:Content>
VB.NET PAGE - default.aspx.vb
Code:
Partial Class NavMaster
    Inherits System.Web.UI.MasterPage
    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        lblPageTitle.Text = SiteMap.CurrentNode.Description
    End Sub
End Class
RESULTING CODE
Code:
<!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>
    <title>Douglas County, Kansas - Home</title>
    <link rel="stylesheet" type="text/css" media="screen" href="docs/css/screen.css" />
    <style type="text/css">
        .ctl00_Menu1_0 { background-color:white;visibility:hidden;display:none;position:absolute;left:0px;top:0px; }
        .ctl00_Menu1_1 { text-decoration:none; }
        .ctl00_Menu1_2 {  }
        .ctl00_Menu2_0 { background-color:white;visibility:hidden;display:none;position:absolute;left:0px;top:0px; }
        .ctl00_Menu2_1 { text-decoration:none; }
        .ctl00_Menu2_2 {  }
        .ctl00_Menu2_3 {  }
        .ctl00_Menu2_4 { padding:0px 0px 0px 0px; }
        .ctl00_Menu2_5 { padding:0px 0px 0px 0px; }
    </style>
</head>
<body>
    <form name="aspnetForm" method="post" action="default.aspx" id="aspnetForm">
    <div>
        <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value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fBAUHZUFsZXJ0cx8BBQdlQWxlcnRzHwUFLC9NYXN0ZXJQYWdlU2l0ZS9vbmxpbmVfc2VydmljZXMvZWFsZXJ0cy5hc3B4HwgFB2VBbGVydHMfBmcfB2cfCQUsL21hc3RlcnBhZ2VzaXRlL29ubGluZV9zZXJ2aWNlcy9lYWxlcnRzLmFzcHgfAmdkZAITDw8WAh8EBQRIb21lZGQYAQULY3RsMDAkTWVudTEPD2QFBEhvbWVkXp6pLJa+v0aDYZ0Mw0FTTM5KeMs=" />
    </div>

    <script type="text/javascript">
        <!--
        var theForm = document.forms['aspnetForm'];
        if (!theForm) {
            theForm = document.aspnetForm;
        }
        function __doPostBack(eventTarget, eventArgument) {
            if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
                theForm.__EVENTTARGET.value = eventTarget;
                theForm.__EVENTARGUMENT.value = eventArgument;
                theForm.submit();
            }
        }
        // -->
    </script>


    <script src="/MasterPageSite/WebResource.axd?d=KKLQ16-PAjSAdMyUqtO2OA2&amp;t=632996128439938112" type="text/javascript"></script>


    <script src="/MasterPageSite/WebResource.axd?d=9YVgtnxkl_EC7ZeDVABhuQ2&amp;t=632996128439938112" type="text/javascript"></script>
    <div id="wrapper">

                <div id="tabs">
            <a href="#ctl00_Menu2_SkipLink"><img alt="Skip Navigation Links" src="/MasterPageSite/WebResource.axd?d=C877-NPBnLlA_xyeDHjJzA2&amp;t=632996128439938112" width="0" height="0" style="border-width:0px;" /></a>
            <table id="ctl00_Menu2" class="ctl00_Menu2_5 ctl00_Menu2_2" cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(this)" id="ctl00_Menu2n0">
                    <table class="ctl00_Menu2_4" cellpadding="0" cellspacing="0" border="0" width="100%">
                        <tr>
                            <td style="white-space:nowrap;"><a class="ctl00_Menu2_1 ctl00_Menu2_3" href="default.aspx"><img src="images/gif/tab1_active.gif" alt="" style="border-style:none;vertical-align:middle;" /></a></td>
                        </tr>
                    </table>
                    </td>
                    <td style="width:3px;"></td>
                    <td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(this)" id="ctl00_Menu2n1">
                    <table class="ctl00_Menu2_4" cellpadding="0" cellspacing="0" border="0" width="100%">
                        <tr>
                            <td style="white-space:nowrap;"><a class="ctl00_Menu2_1 ctl00_Menu2_3" href="aboutus/aboutus.aspx"><img src="images/gif/tab2_active.gif" alt="" style="border-style:none;vertical-align:middle;" /></a></td>
                        </tr>
                    </table>
                    </td>
                <td style="width:3px;"></td>
                <td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(this)" id="ctl00_Menu2n2">
                <table class="ctl00_Menu2_4" cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                        <td style="white-space:nowrap;"><a class="ctl00_Menu2_1 ctl00_Menu2_3" href="depts/depts.aspx"><img src="images/gif/tab3_active.gif" alt="" style="border-style:none;vertical-align:middle;" /></a></td>
                    </tr>
                </table>
                </td>
                </tr>
            </table>
            <a id="ctl00_Menu2_SkipLink"></a>
        </div>

        <div id="screenleft">


            <div id="screenleftnav">
                   <div class="leftheader">About Us</div>
                    [list]
                        <li><a href="">Button 1</a></li>
                        <li><a href="">Button 2</a></li>
                        <li><a href="">Button 3</a></li>
                        <li><a href="">more...</a></li>
                    </ul>
                <div class="leftheader">Departments</div>
                    [list]
                           <li><a href="">Button 4</a></li>
                        <li><a href="">Button 5</a></li>
                        <li><a href="">Button 6</a></li>
                        <li><a href="">more...</a></li>
                    </ul>
                    <br />
            </div>

        </div>

        <div id="content">

            <h1><span id="ctl00_lblPageTitle">Home</span></h1>
                    <br />


                    <span id="ctl00_SiteMapPath1"><a href="#ctl00_SiteMapPath1_SkipLink"><img alt="Skip Navigation Links" height="0" width="0" src="/MasterPageSite/WebResource.axd?d=C877-NPBnLlA_xyeDHjJzA2&amp;t=632996128439938112" style="border-width:0px;" /></a><span>Home</span><a id="ctl00_SiteMapPath1_SkipLink"></a></span>
                    <br /><br />

                This is the main content section
        </div>

        <div id="screenright">

    <div id="screenright">
        This is the right content section
    </div>

    <div id="screenfooter">
        This is the footer section
    </div>
    </div>


<div>

    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWDQLLxL+WBgLIi9OIAQLf6Ie+DQLdgvPlDQKO1LKcCwLb4MClDQLggdHzAwLb4MClDQLggdHzAwLb4MClDQLggdHzAwLb4MClDQLggdHzAxNB1ZKW3G9fVbk/8m+rafTOxMR4" />
</div>

<script type="text/javascript">
    <!--
    var ctl00_Menu1_Data = new Object();
    ctl00_Menu1_Data.disappearAfter = 5;
    ctl00_Menu1_Data.horizontalOffset = 0;
    ctl00_Menu1_Data.verticalOffset = 0;
    var ctl00_Menu2_Data = new Object();
    ctl00_Menu2_Data.disappearAfter = 500;
    ctl00_Menu2_Data.horizontalOffset = 0;
    ctl00_Menu2_Data.verticalOffset = 0;
    // -->
</script>
</form>
</body>
</html>
KWilliams





Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP: XML/XSLT/ASP.NET Calendar Control kwilliams XSLT 14 May 8th, 2008 03:43 PM
XML/XSLT Transform Error in ASP kwilliams Classic ASP XML 2 October 9th, 2007 02:26 AM
XML > XSLT and ASP.NET 2.0 bonekrusher XSLT 7 September 22nd, 2006 06:26 PM
Transforming XML data in an ASP file using XSLT hussainm Classic ASP XML 0 May 31st, 2006 03:21 PM
XML to XML through an XSLT (VB.NET) dimondwoof XSLT 1 June 25th, 2003 12:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.