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 8456027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:26:28+00:00 2026-06-10T12:26:28+00:00

I have a data bound repeater on my ASP.NET page. I am using the

  • 0

I have a data bound repeater on my ASP.NET page. I am using the repeater to build a list of elements, each one consisting of a text (given by a column in the data bound table) that may be hyperlinked to another page. Whether or not a hyperlink should be included is determined by another column in the data bound table.

I am not sure how to approach the problem. Should I use an HyperLink server control that is shown or hidden depending on the value in the second column? How can I then change the Visible property of this control for each item in the repeater? Are there better approaches?

Thanks.

  • 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-06-10T12:26:29+00:00Added an answer on June 10, 2026 at 12:26 pm

    You can have two controls. One being a hyperlink and one being a regular label or literal. Then, in the ItemDataBound event, show / hide the appropriate controls based on the value of that second column. See the example code below. You will obviously need to change it to fit your situation.

    Private Sub Repeater_ItemDataBound(ByVal sender As Object, Byval e As RepeaterItemEventArgs)
      If (e.Item.ItemType Is ListItemType.Item) Or (e.Item.ItemType Is ListItemType.AlternatingItem) Then
        Dim hyperlink = CType(e.Item.FindControl("HyperLink1"), HyperLink)
        Dim label = CType(e.Item.FindControl("Label1"), Label)
        Dim dataSource = CType(e.Item.DataItem, MyDataSourceObject)
    
        If (dataSource.HyperLink = String.Empty) Then
          hyperlink.visible = false
        Else
          label.visible = false
          hyperlink.NavigateUrl = dataSource.HyperLink
        End If
      End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a repeater that's bound to a SQL Data Source (using ASP.NET). Are
I have a .NET repeater control that is data-bound to a List. As part
I use ADO.NET Entity-Framework, I have a page that is data-bound to an entity
I have an ASP.NET repeater pulling comment data from a database. In my ItemTemplate
I have an ASP.NET data repeater. This is currently set to a data source
I have an ASP.NET web form that uses an ASP.NET Repeater. The data source
Here's the problem: I have a data-bound list of items, basically a way for
I have a vb.net 2010 form with 22 data bound controls from two tables
I have an ASP.NET web app that places several string data into an object
I am using Repeater in asp.net, i want to display total number of records.

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.