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?????

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.