Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6191455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:46:04+00:00 2026-05-24T02:46:04+00:00

How to access the ‘HyperlinkID1’ control with the headertemplate? I like to change the

  • 0

How to access the ‘HyperlinkID1’ control with the headertemplate?
I like to change the value like below but i can’t access the control because it keep telling that “The name ‘HyperlinkID1’ does not exist in the current context”

if (!IsPostBack)
{
     HyperlinkID1.ImageUrl = "asc.jpg";//change image
}
else
{
     HyperlinkID1.ImageUrl = "asc.jpg";//change image
}

    <%@ Page Language="C#" %>

    <!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></title>
    </head>
    <script language="C#" runat="server">
        public class PositionData
        {
            private string name;
            private string ticker;
            public PositionData(string name, string ticker)
            {
                this.name = name;
                this.ticker = ticker;
            }
            public string Name
            {
                get
                {
                    return name;
                }
            }
            public string Ticker
            {
                get
                {
                    return ticker;
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                HyperlinkID1.ImageUrl = "asc.jpg";//change image

            }
            else
            {
                HyperlinkID1.ImageUrl = "asc.jpg";//change image
            }


            if (!IsPostBack)
            {
                ArrayList values = new ArrayList();

                values.Add(new PositionData("Microsoft", "Msft"));
                values.Add(new PositionData("Intel", "Intc"));
                values.Add(new PositionData("Dell", "Dell"));

                Repeater1.DataSource = values;
                Repeater1.DataBind();


            }
        }
    </script>
    <body>
        <form runat="server">
        <b>Repeater1:</b>
        <asp:Repeater ID="Repeater1" runat="server">
            <HeaderTemplate>
                <table border="1">
                    <tr>
                        <td><b>Company</b>
                            <asp:HyperLink ID="HyperlinkID1" runat="server" ImageUrl="desc.jpg" NavigateUrl="nextpage.aspx">HyperLink</asp:HyperLink></td>
                        <td><b>Symbol</b></td>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td><%# DataBinder.Eval(Container.DataItem, "Name") %> </td>
                    <td><%# DataBinder.Eval(Container.DataItem, "Ticker") %> </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
        </form>
    </body>
    </html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:46:05+00:00Added an answer on May 24, 2026 at 2:46 am

    The control does not exist. You need to declare an OnItemCreated method linked to your repeater, and in this do a FindControl for the control name, and set the value in this.

    ETA – in response to the comment.

    <asp:Repeater OnItemCreated="rptItemCreated" >
    
    .
    .
    .
    

    And in the code you need to define the new method defined:

    protected void rptItemCreated(Object Sender, RepeaterItemEventArgs e)
    {
    
        if(e.Item.ItemType==ListItemType.Header)
        {
            HtmlAnchor HyperLinkID1=(HtmlAnchor)e.Item.FindControl("HyperLinkID1");
            HyperlinkID1.ImageUrl = IsPostBack?"asc.jpg":"asc.jpg;
        }
    }
    

    Note this is typed from memory, and so may need some tweaking. Also I have put the code you had into an abreviated form, which is equivalent but briefer to format.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Access is telling me the following is improper, but I can't see how. cnt
MS Access appears to support nulls in code, but I can't for the life
Access can open DBF (dBase) files, but instead of physically converting the data into
Access modifiers like public , private are not allowed on static constructors in C#.
Any Access guru's out there that can help me out? Trying to figure out
Using Access 2003 I want to get a table value from the two databases
Access 2007 is telling me that my new expression is to complex. It used
can access 2010 open a 2003 database that has the old mdw security
is access 2007 can work good with 30 users parallel through my C# program
Access automatically converts any value under 100. ie: 0099 converts to 1999 and 0010

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.