:) hai can any one help me that how we can display values in a repeater from the database in c#

Recommended Answers

All 3 Replies

sure, post what you have then we can go from there

don't get caught up that this is a repeater, a repeater is very simple, it just automatically loops through the datasource for you

The repeater control is like its name indicates it reaptes the way the data is displayed. Its main use is because of its flexibilti in displaying data. Here are some clues to help you. First when you add your control set the values you want to display then in your code set the data source and bind the repeater:

<asp:Repeater id="myRepeater" runat="server">
 <ItemTemplate>
  <%# Eval("Name") %>
 </ItemTemplate>
</asp:Repeater>

myRepeater.DataSource = reader
myRepeater.DataBind()

Here are some decription from a book:
To gain greater flexibility in the presentation of our results, we can provide the
Repeater control with a number of different types of templates, which the
Repeater will use in the circumstances described in the list of templates below.
Each of these templates must be specified in a child tag of the <asp:Repeater>
tag:

<HeaderTemplate>
This template provides a header for the output. If we’re generating an HTML
table, for example, we could include the opening <table> tag, provide a row
of header cells (th), and even specify a caption for the table.

<ItemTemplate>
The only template that is actually required, <ItemTemplate> specifies the
markup that should be output for each item in the data source. If we were generating an HTML table, this template would contain the <td> and </td>
tags and their contents.

<AlternatingItemTemplate>
This template, if provided, will be applied instead of ItemTemplate to every
second record in the data source, making it easy to produce effects such as
alternating table row colors.

<SeparatorTemplate>
This template provides markup that will appear between the items in the
data source. It will not appear before the first item or after the last item.

<FooterTemplate>
This template provides a footer for the resulting output, which will appear
after all the items in the data source. If you’re generating an HTML table,
you could include the closing </table> tag in this template.

sure, post what you have then we can go from there

don't get caught up that this is a repeater, a repeater is very simple, it just automatically loops through the datasource for you

ok thank u .
how to insert selected values into the repeater where we are getting the selected values from the sql query.

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.