0

Hi , i am working on a web project , and there is a page where i have to display news. i am using repeater control , and it is working fine , but i want to add a "read more" link on long posts , i searched a lot , but dnt get any idea , could u help me in this?????

3
Contributors
2
Replies
13
Views
4 Years
Discussion Span
Last Post by geniusvishal
0

In your <itemTemplate> section, you can include a link to the location where the complete article is located. Since this link will be built dynamically, you need to include the article ID or full URL which I would imagine that you are storing in a database table.

Here is an example...while its incomplete, its purpose is to give you an idea....

<asp:Repeater ID="Repeater1" runat="server">
  <ItemTemplate>
    <p>A summary of your news....
      <a href="<%# Eval("URL")%>" />[Read More]</a>
    </p>
  </ItemTemplate>
</asp:Repeater>

Of course, you need to tie the repeater to a data source and reference the correct fields in your code.

If you only want to include [Read More] on certain posts, you can store that entire link element in another field where some of your articles have this field as NULL while others have the link info. Then, in your repeater, evaluate this field and if there is nothing to display, it will be blank, where if the field has a value, it will be shown. Otherwise, handle this in your code behind in another manner.

Edited by JorgeM

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.