troubleshooting Question

How Do I find a control on masterpage from a content page

Avatar of vstack
vstack asked on
3 Comments1 Solution409 ViewsLast Modified:
Hi Experts,

I am using masterpages with a menu set up via hyperlinks as listitems.

I am trying to reference the hyperlinks to appy the "current" CSS Class. I cannot find the link.  I am using the following in page load but I cannot 'find' the control.

 Dim mpHyperLinkHome As HyperLink = CType(Master.FindControl("HyperLinkHomeMaster"), HyperLink)
            If mpHyperLinkHome Is Nothing Then
                Response.Write("no find the link")

                mpHyperLinkHome.CssClass = "current"
            End If

..... in Masterpage
                <ul class="sf-menu">
                        <asp:HyperLink ID="HyperLinkHomeMaster" runat="server" NavigateUrl="~/Default.aspx">Home</asp:HyperLink></li>
                    <li><a href="index-1.html">Services</a>
                            <li><a href="#">Production practice</a></li>
                            <li><a href="#">Genetic engineering</a></li>
                            <li><a href="#">Costs and benefits</a>
                                      <li><a href="#">Procesing</a></li>
                                    <li><a href="#">Distribution</a></li>
                                    <li><a href="#">Marketing</a></li>
                            <li class="last"><a href="#">Economics and agriculture</a></li>
                    <li><a href="products.aspx">Products</a></li>
                    <li><a href="index-3.html">Technology</a></li>
                    <li><a href="index-4.html">Contact Us</a></li>
Miguel Oz
Senior Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2009

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros