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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:02:10+00:00 2026-05-17T16:02:10+00:00

I have a repeater that displays a custom user control on a form multiple

  • 0

I have a repeater that displays a custom user control on a form multiple times as follows:

<asp:Repeater runat="server" ID="MyRepeater" 
    ondatabinding="MyRepeater_DataBinding" >
    <ItemTemplate>
        <a name='<%# Eval("[\"Key\"]") %>' style="display: none;"></a>            

        <uc1:MyControl ID="Control1" runat="server" 
            Info='<%#Eval("[\"Info\"]") %>' Date='<%#Eval("[\"Date\"]") %>' 
             Key='<%#Eval("[\"Key\"]") %>' />/>
    </ItemTemplate>
</asp:Repeater>

Binding this to a SQL data source correctly displays the information that I expect:

    SqlDataSource.SelectCommand =
                "SELECT Info, Date, Key " +
                "FROM [dbo].[Test] ";
    SqlDataSource.SelectCommandType = SqlDataSourceCommandType.Text;
    DataView resultsdv = (DataView)SqlDataSource.Select(DataSourceSelectArguments.Empty);

    MyRepeater.DataSource = resultsdv.Table.Rows;
    MyRepeater.DataBind();

What I can’t work out is how to reference an individual element of this to go directly to the specific item that I want, for example, to link an item from another web-site. I’m trying to use the Facebook “Like” function, and so I believe I need a URL that will take me directly to the item in question. Can anyone point me in the right direction on this, please?

EDIT:

What I’m looking for is a way to reference a single item within the data repeater from outside the web-site. For example:

http://www.mywebsite.com/MyPage/InfoItem3

EDIT:

Changed above code to reflect answers given using an tag. Trying to reference the page using:

http://www.mywebsite.com/MyPage#Key

e.g.

http://www.mywebsite.com/MyPage#10

Simply reloads the page

EDIT:

HTML from the user control:

<script type="text/javascript" >
$(function() {
    var iframe = $("#likeButton");
    var newSrc = iframe.attr("src");
    newSrc += encodeURIComponent(location.href) + "<%= lblKey.Text %>";

    iframe.attr("src", newSrc);

});
</script>

<asp:Label runat="server" ForeColor="blue" Text="Date" Font-Bold="true" Font-Size="Smaller" ID="lblDate" Width="100%" />
<br />
<asp:Label runat="server" Text="Info" ID="lblInfo" Font-Size="Smaller" />
<br />
<asp:Label runat="server" Text="Key" ID="lblKey" Font-Size="Smaller" Visible="true" />
<br />
<iframe id="likeButton"
    src="http://www.facebook.com/plugins/like.php?href=" 
    scrolling="no" 
    frameborder="0"         
    style="border:none; overflow:hidden; 
    width:450px; height:80px;">
</iframe>
<br />
  • 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-17T16:02:10+00:00Added an answer on May 17, 2026 at 4:02 pm

    Try this code for your user control (you don’t need Javascript):

    <asp:Label runat="server" ForeColor="blue" Text="Date" Font-Bold="true" Font-    Size="Smaller" ID="lblDate" Width="100%" /> 
    <br /> 
    <asp:Label runat="server" Text="Info" ID="lblInfo" Font-Size="Smaller" /> 
    <br /> 
    <asp:Label runat="server" Text="Key" ID="lblKey" Font-Size="Smaller" Visible="true" /> 
    <br /> 
    <iframe id="likeButton" 
        src="http://www.facebook.com/plugins/like.php?href=<%# lblKey.Text %>"  
        scrolling="no"  
        frameborder="0"          
        style="border:none; overflow:hidden;  
        width:450px; height:80px;"> 
    </iframe> 
    <br />
    
    • 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 will output a series of items: <asp:repeater ... runat=Server>
I have a user control in a repeater that I need to pass data
I have a .NET repeater control that is data-bound to a List. As part
I know that the asp.net repeater doesnt have a Client side object model, and
I have an ASP.NET page that uses a repeater nested within another repeater to
I have some code that prints out databse values into a repeater control on
I have a repeater that outputs divs like the following for every item returned
I have a repeater control where in the footer I have a DropDownList. In
I have a block of code that is repeated within a DB2 stored procedure.
Possible Duplicate: Avoiding repeated constants in CSS We have some theme colors that are

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.