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

  • Home
  • SEARCH
  • 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 6244265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:17:50+00:00 2026-05-24T12:17:50+00:00

I use asp.net and c#4. I have a repeater within inside a HyperLink Control.

  • 0

I use asp.net and c#4.

I have a repeater within inside a HyperLink Control.

I need to Find the HyperLink Control and change some of its properties with some logic before rendering it on the page.

With my code here posted I get a null value for the control so I’m not able to get it.

Any idea what I’m doing wrong? Thanks for your time on this.

<asp:Repeater ID="RepeaterEditorsChoice" runat="server" DataSourceID="ObjectDataSourceEditorsChoice"
    OnItemCreated="RepeaterEditorsChoice_ItemCreated" OnItemDataBound="RepeaterEditorsChoice_ItemDataBound">
    <HeaderTemplate>
        <ul>
    </HeaderTemplate>
    <ItemTemplate>
        <li>
            <asp:HyperLink ID="uxLink" runat="server"></asp:HyperLink>
        </li>
    </ItemTemplate>
    <FooterTemplate>
        </ul>
    </FooterTemplate>
</asp:Repeater>

CODE BEHIND:

protected void RepeaterEditorsChoice_ItemCreated(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            HyperLink myLink = (HyperLink)((Repeater)sender).FindControl("uxLInk"); // ERROR: it is null
            dynamic o = e.Item.DataItem;
            if (o.TypeContent == "AR")
            {

                myLink.Text = @"'<%# Eval(\""Title\"") %>'";
                myLink.NavigateUrl = @"'<%# GetRouteUrl(""ArticleDetails"", new {ContentId = Eval(""ContentId""), TitleUrl = Eval(""TitleUrl"")}) %>'";
            }
            if (o.TypeContent == "BP")
            {
                myLink.Text = @"'<%# Eval(\""Title\"") %>'";
                myLink.NavigateUrl = @"'<%# GetRouteUrl(""BlogPostDetails"", new {ContentId = Eval(""ContentId""), TitleUrl = Eval(""TitleUrl"")}) %>'";
            }
        }
    }
  • 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-24T12:17:51+00:00Added an answer on May 24, 2026 at 12:17 pm

    On item data bound

    then just (YourClass)e.Item.FindControl("its name");

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

Sidebar

Related Questions

I use ASP.NET and have a label control on my page, which I fill
I'm trying to use ASP.net profiles I've followed some instructions which means I have
Suppose you have two seperate ASP.NET Web Application projects that both need to use
I have an ASP.NET webform on which I use a DropDownList control to allow
I use asp.net + MVC1.0 and in a web-page I have several forms, within
I'm trying to use ASP.NET's Repeater objects to loop over properties of an object.
I have an ASP.Net Repeater I want to use to show From and Text
I have an Asp.Net repeater, which contains a textbox and a checkbox. I need
I use asp.net 4 and C#. I have some nested Master Pages; I display
I read that one cannot use ASP.NET MVC with Server Control which have ViewState

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.