Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Problem Displaying Data Using Repeater Control

Problem Displaying Data Using Repeater Control

Problem Displaying Data Using Repeater Control

Hi There,
I am trying to display data from an SQL database using the Repeater control in ASP.net, but I’ve run into some difficulty. Primarily, when a user selects an item from a menu, data from an SQL table is displayed using Gridview – this works perfectly ok. Additionally, I want a subset of the Gridview data to be displayed  using the Repeater control - this is where I have the problem: the two sets of  data  are not  displayed simultaneously when a menu selection is made. Instead, the data from the previous menu selection is displayed. In short, the Repeater data lags behind the Gridview data.

Sub Page_Load
    If Not Page.IsPostBack then
    Dim SQLstring As Object
If MenuSearch = "selected item" Then
        SQLString = "SELECT * FROM ProductsTab " & _         
           "WHERE OuterCategory = '" & MenuSearch & "' " & _
        "IF OBJECT_ID(N'ProductsDB..BrandsTab') IS NOT NULL " &     
         "DROP TABLE BrandsTab " & _
"SELECT Brand, COUNT(*) AS BrandCount INTO BrandsTab FROM ProductsTab " & _             
           "WHERE OuterCategory = '" & MenuSearch & "' " & _
         "GROUP BY Brand "
    SqlDataSource2.SelectCommand = SQLString
   End If
End Sub
Note: Data from ProductsTab is displayed in Gridview, data from BrandsTab is displayed in Repeater. The subset of selection from ProductsTab is saved in BrandsTab.
The Repeater code is:-
<asp:Repeater runat="server" id="Repeater1" DataSourceID="SqlDataSourceBrand" OnItemCreated="Repeater1_ItemCreated" >
        <asp:Label Text='<%# Eval("Brand") %>' runat="server"/>  
        <br />        
<asp:Label Text='<%# Eval("BrandCount") %>' runat="server"/>    
I hope the above code helps to explain my problem. I would greatly appreciate any help.

RE: Problem Displaying Data Using Repeater Control

Hi and welcome to Tek-Tips. Start by reading FAQ222-2244: How to get the best answers, then post this question in forum855: Microsoft: ASP.NET

If you want the best response to a question, please check out FAQ222-2244: How to get the best answers first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints

RE: Problem Displaying Data Using Repeater Control

This is a VB6 for databases forum.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close