Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 October 17th, 2006, 07:51 AM
Registered User
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default System.Web.UI.Control.Controls Collection

As part of an abstracted method for changing styles on <a> HtmlAnchors I tried to recurse down through child controls starting with a parameter control. However, the <a> HtmlAnchors within the <td> HtmlTableCells are never seen by the method. aspx and asp.cs extract as follows:


<tr id="trSupplierLinks" runat="server">
    <td valign="top"><a class="navagation_link_normal" href='<%=Application["VirPath"]%>supplier/details_new.aspx'>Details 
            &amp; Service Zones</a></td>
    <td valign="top">|</td>
    <td valign="top"><a class="navagation_link_normal" href='<%=Application["VirPath"]%>supplier/instructions.aspx'>Instructions 
    <td valign="top">|</td>
    <td valign="top"><a class="navagation_link_normal" href='<%=Application["VirPath"]%>supplier/rates_manage.aspx'>General 
            Waste Schedule</a></td>
    <td valign="top">|</td>
    <td valign="top"><a class="navagation_link_normal" href='<%=Application["VirPath"]%>supplier/rates_manage_clean.aspx'>Clean 
            Fill Schedule</a></td>
    <td valign="top">|</td>
    <td valign="top"><a class="navagation_link_normal" href='<%=Application["VirPath"]%>supplier/rates_manage_green.aspx'>Green 
            Waste Schedule</a></td>
    <td valign="top">|</td>
    <td valign="top"><a class="navagation_link_normal" href='<%=Application["VirPath"]%>supplier/rates_manage.aspx?logout=true'>Log 
    <asp:Literal ID="litTest" Visible="False" Runat=server>
            <td valign="top">|</td>
    <td valign="top"><a class="navagation_link_normal" href='order_receipting.aspx'>Order 

protected void UpdateNavagationLinks(Control objLinksParent)

            HtmlAnchor objNavLink;
            string sCurrentURL = Request.ServerVariables["URL"];
            string sStyleClass;
            foreach (Control objNavControl in objLinksParent.Controls)
                if(objNavControl.GetType() == Type.GetType("HtmlAnchor"))
                    objNavLink = (HtmlAnchor)objNavControl;
                    sStyleClass = objNavLink.Attributes["class"];
                    if(sStyleClass.IndexOf("navagation_link") < 1)
                    aText.Text = aText.Text + objNavLink.HRef + " " + sCurrentURL;
                    if(objNavLink.HRef == sCurrentURL)
                        sStyleClass = "navagation_link_current";
                        sStyleClass = "navagation_link_normal";


Strangly enough the "|"'s *do* show up in the method (as HtmlLiterals). But the anchor tags dont.

Thanks in advance.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mobile Control in System.Web.UI.Page hpfarstad ASP.NET 2.0 Professional 0 August 28th, 2006 05:00 AM
No System.Web.UI alexanderH BOOK: ASP.NET Website Programming Problem-Design-Solution 2 March 10th, 2005 03:04 AM
namespace System.Web.UI henninga BOOK: ASP.NET Website Programming Problem-Design-Solution 9 November 16th, 2004 03:51 PM
Subclassing system.web.ui.page gazeth BOOK: ASP.NET Website Programming Problem-Design-Solution 2 May 25th, 2004 10:02 AM

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