Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 5th, 2008, 01:45 PM
Posts: n/a
Default 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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with binding XMl data into nested repeater vishnu108mishra XML 0 November 19th, 2007 03:53 AM
Problem in Displaying preselected data in dropdown deb_kareng ASP.NET 2.0 Professional 2 August 14th, 2007 05:00 AM
Repeater control. rupen ASP.NET 1.0 and 1.1 Basics 1 October 14th, 2005 08:34 AM
Trouble displaying Data Grid control bam1934 ASP.NET 1.0 and 1.1 Basics 4 May 25th, 2005 07:59 AM

All times are GMT -4. The time now is 04:17 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.