Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 5th, 2008, 01:45 PM
cyberstore05
Guest
 
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" >
    <ItemTemplate>
        <asp:Label Text='<%# Eval("Brand") %>' runat="server"/>
        <br />
<asp:Label Text='<%# Eval("BrandCount") %>' runat="server"/>
    </ItemTemplate>
</asp:Repeater>
I hope the above code helps to explain my problem. I would greatly appreciate any help.







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





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