473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Combine many Repeaters into 1

Roy
No errors here, I'm just looking for ways to make my code more
efficient. As the subject line suggests, I have a LOT of repeaters on a
certain page. They are visible or hidden depending on user actions and
are dispersed about the page via an "image map" style of GUI. The code
behind (and associated aspx) is below, you'll note that they all pull
from the same table and all virtually identical except for ID's and what
data they pull. How can I make this more efficient? Can I combine all
the repeaters into one and pull via a relation some-how? If so, how
would I do this?
THANKS

*****Code behind*****

Dim mycom1 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'jar'
group by b.site", myconn)
Dim newadp1 As New SqlDataAdapter(mycom1)
Dim newds1 As New DataSet
newadp1.Fill(newds1, "one")
notesgrid1.DataSource = newds1.Tables("one").DefaultView
notesgrid1.DataBind()

Dim mycom2 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'ncn'
group by b.site", myconn)
Dim newadp2 As New SqlDataAdapter(mycom2)
Dim newds2 As New DataSet
newadp2.Fill(newds2, "one")
notesgrid2.DataSource = newds2.Tables("one").DefaultView
notesgrid2.DataBind()

Dim mycom3 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'trz'
group by b.site", myconn)
Dim newadp3 As New SqlDataAdapter(mycom3)
Dim newds3 As New DataSet
newadp3.Fill(newds3, "one")
notesgrid3.DataSource = newds3.Tables("one").DefaultView
notesgrid3.DataBind()

Dim mycom4 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'lb1'
group by b.site", myconn)
Dim newadp4 As New SqlDataAdapter(mycom4)
Dim newds4 As New DataSet
newadp4.Fill(newds4, "one")
notesgrid4.DataSource = newds4.Tables("one").DefaultView
notesgrid4.DataBind()

Dim mycom5 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'lrd'
group by b.site", myconn)
Dim newadp5 As New SqlDataAdapter(mycom5)
Dim newds5 As New DataSet
newadp5.Fill(newds5, "one")
notesgrid5.DataSource = newds5.Tables("one").DefaultView
notesgrid5.DataBind()

*****ASPX code*****

<div ID="note1" class="note">
<asp:repeater id="notesgrid1" Runat="server">
<HeaderTemplate>
Area 1
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate><br></SeparatorTemplate>
</asp:repeater>
</div>

<div ID="note2" class="note">
<asp:repeater id="notesgrid2" Runat="server">
<HeaderTemplate>
Area 2
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate>
<br>
</SeparatorTemplate>
</asp:repeater>
</div>

<div ID="note3" class="note">
<asp:repeater id="notesgrid3" Runat="server">
<HeaderTemplate>
Area 3
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate>
<br>
</SeparatorTemplate>
</asp:repeater>
</div>

<div ID="note4" class="note">
<asp:repeater id="notesgrid4" Runat="server">
<HeaderTemplate>
Area 4
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate>
<br>
</SeparatorTemplate>
</asp:repeater>
</div>

<div ID="note5" class="note">
<asp:repeater id="notesgrid5" Runat="server">
<HeaderTemplate>
Area 5
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate>
<br>
</SeparatorTemplate>
</asp:repeater>
</div>

*** Sent via Developersdex http://www.developersdex.com ***
Mar 1 '06 #1
1 1418
Roy
Quick repost since no answers first time:
Anyone have any thoughts on this?
Thanks much.
From: Roy

No errors here, I'm just looking for ways to make my code more
efficient. As the subject line suggests, I have a LOT of repeaters on a
certain page. They are visible or hidden depending on user actions and
are dispersed about the page via an "image map" style of GUI. The code
behind (and associated aspx) is below, you'll note that they all pull
from the same table and all virtually identical except for ID's and what
data they pull. How can I make this more efficient? Can I combine all
the repeaters into one and pull via a relation some-how? If so, how
would I do this?
THANKS

*****Code behind*****

Dim mycom1 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'jar'
group by b.site", myconn)
Dim newadp1 As New SqlDataAdapter(mycom1)
Dim newds1 As New DataSet
newadp1.Fill(newds1, "one")
notesgrid1.DataSource = newds1.Tables("one").DefaultView
notesgrid1.DataBind()

Dim mycom2 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'ncn'
group by b.site", myconn)
Dim newadp2 As New SqlDataAdapter(mycom2)
Dim newds2 As New DataSet
newadp2.Fill(newds2, "one")
notesgrid2.DataSource = newds2.Tables("one").DefaultView
notesgrid2.DataBind()

Dim mycom3 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'trz'
group by b.site", myconn)
Dim newadp3 As New SqlDataAdapter(mycom3)
Dim newds3 As New DataSet
newadp3.Fill(newds3, "one")
notesgrid3.DataSource = newds3.Tables("one").DefaultView
notesgrid3.DataBind()

Dim mycom4 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'lb1'
group by b.site", myconn)
Dim newadp4 As New SqlDataAdapter(mycom4)
Dim newds4 As New DataSet
newadp4.Fill(newds4, "one")
notesgrid4.DataSource = newds4.Tables("one").DefaultView
notesgrid4.DataBind()

Dim mycom5 As New SqlCommand("SELECT b.site, count(*)as cnt from cm_last
a right join theater b on a.loc_cd = b.geo_code where b.area = 'lrd'
group by b.site", myconn)
Dim newadp5 As New SqlDataAdapter(mycom5)
Dim newds5 As New DataSet
newadp5.Fill(newds5, "one")
notesgrid5.DataSource = newds5.Tables("one").DefaultView
notesgrid5.DataBind()

*****ASPX code*****

<div ID="note1" class="note">
<asp:repeater id="notesgrid1" Runat="server">
<HeaderTemplate>
Area 1
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate><br></SeparatorTemplate>
</asp:repeater>
</div>

<div ID="note2" class="note">
<asp:repeater id="notesgrid2" Runat="server">
<HeaderTemplate>
Area 2
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate>
<br>
</SeparatorTemplate>
</asp:repeater>
</div>

<div ID="note3" class="note">
<asp:repeater id="notesgrid3" Runat="server">
<HeaderTemplate>
Area 3
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate>
<br>
</SeparatorTemplate>
</asp:repeater>
</div>

<div ID="note4" class="note">
<asp:repeater id="notesgrid4" Runat="server">
<HeaderTemplate>
Area 4
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate>
<br>
</SeparatorTemplate>
</asp:repeater>
</div>

<div ID="note5" class="note">
<asp:repeater id="notesgrid5" Runat="server">
<HeaderTemplate>
Area 5
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("site")%> (<%# container.dataitem("cnt")%>)
</ItemTemplate>
<SeparatorTemplate>
<br>
</SeparatorTemplate>
</asp:repeater>
</div>

*** Sent via Developersdex http://www.developersdex.com ***
Mar 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David B | last post by:
Bare with me this is my first post. Objective: To dynamically create repeaters in a WebForm based on sets of data. Problem: When I attempt to create any Repeater from C# I get a big fat white...
3
by: DonRex | last post by:
Hello all! I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if this is the wrong forum! Synopsis: In my webform I have 3 nested repeaters: rpWeeks ----- rpTime
0
by: Paul | last post by:
I want to be able to nest a repeater in a datagrid or datalist. I'm not unduly bothered about a master/child relationship as such as there'll at this stage only ever be one record on the page, but...
0
by: Machi | last post by:
let say in parent-child scenerio (Product: Product Category - one product category may has many products), i am using nested repeaters where parent repeater will be used to display info and child...
0
by: kettch | last post by:
Is it possible to have nested repeaters three layers deep I have gotten it to work with only two, and when I tried to get the third layer to work COD <asp:repeater id="rep"...
1
by: garethdjames | last post by:
Please can some on offer some practicle advice, I am designing a page that displays details about a product, the page will be navigated from a datagrid (this bit no problem), The details page...
1
PrinsonG
by: PrinsonG | last post by:
My Query is How do I export to excel/csv using Nested Repeaters. My project is web-based and i am using C#.Net. In this i use three repeaters. one displays ID, Name of the user. second...
1
by: andrew.douglas11 | last post by:
Hello all, Is it possible to share controls inside a child repeater? Here's the situation: I have a web page that needs to display data grouped by A, and alternatively by B (only one grouping...
3
by: Leon Mayne | last post by:
If I have a datatable which looks like this: Record Id, Group Id, Name 1, 1, Test 1 2, 1, Test 2 3, 2, Test 3 4, 3, Test 4 Is it possible to use nested repeaters to group the information by...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.