Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 17th, 2006, 07:51 AM
Registered User
 
Join Date: Oct 2006
Location: Auckland, New Zealand, New Zealand.
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:

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

Code:
<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 
            &amp;<br>
            Information</a></td>
    <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 
            Out</a></td>
    <td>
    <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 
            Receipting</a></td></asp:Literal></td>
</tr>

Code:
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)
                    {
                        continue;
                    }
                    aText.Text = aText.Text + objNavLink.HRef + " " + sCurrentURL;
                    if(objNavLink.HRef == sCurrentURL)
                    {
                        sStyleClass = "navagation_link_current";
                    }
                    else
                    {
                        sStyleClass = "navagation_link_normal";
                    }
                }
                UpdateNavagationLinks(objNavControl);
            }

        }


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

Thanks in advance.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.