Hey all,
I have a gridview which pulls from a BLL which pulls from a DAL
(an .XSD file). Each row on that gridview has a nested repeater which
pulls from another table. The code which populates each nested
repeater is shown below (it's in the gridview's RowDataBound event).
My question is this: what can I do to speed up this process? Currently
EVERY time a new gridview row is generated the code reaches out to the
database, grabs the specific records for the nested repeater, and
closes the connection. This can be a huge overhead if many master
records are displayed.
Naturally my inclination is to grab ALL the records needed in one
database pull and then relate them in the codebehind, but I'm not sure
how to accomplish this given the current structure (with a DAL and
all).
Does anyone have any suggestions to increase efficiency here?
Protected Sub gvITV_RowDataBo und(ByVal sender As Object, ByVal e
As System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles
gvITV.RowDataBo und
Dim nestedRepeater As Repeater =
TryCast(e.Row.F indControl("NR" ), Repeater)
If nestedRepeater IsNot Nothing Then
Dim x As HiddenField = e.Row.FindContr ol("hdnID")
Dim con As SqlConnection = New
SqlConnection(S ystem.Web.Confi guration.WebCon figurationManag er.ConnectionSt rings("Connecti onString").ToSt ring())
Dim sdap As SqlDataAdapter = New
SqlDataAdapter( "dbo.Fsn_WE B", con)
sdap.SelectComm and.CommandType =
CommandType.Sto redProcedure
sdap.SelectComm and.CommandTime out = 0
sdap.SelectComm and.Parameters. Add("new_id", SqlDbType.Int)
sdap.SelectComm and.Parameters. Item(0).Value = x.Value
con.Open()
Dim dt As Data.DataTable = New Data.DataTable
sdap.Fill(dt)
con.Close()
nestedRepeater. DataSource = dt
nestedRepeater. DataBind()
End If
End Sub 2 2599
Anyone? I'd appreciate any advice you all may have.
Thanks
On May 6, 2:44*pm, ASF wrote:
Hey all,
I have a gridview which pulls from a BLL which pulls from a DAL
(an .XSD file). Each row on that gridview has a nested repeater which
pulls from another table. The code which populates each nested
repeater is shown below (it's in the gridview's RowDataBound event).
My question is this: what can I do to speed up this process? Currently
EVERY time a new gridview row is generated the code reaches out to the
database, grabs the specific records for the nested repeater, and
closes the connection. This can be a huge overhead if many master
records are displayed.
Naturally my inclination is to grab ALL the records needed in one
database pull and then relate them in the codebehind, but I'm not sure
how to accomplish this given the current structure (with a DAL and
all).
Does anyone have any suggestions to increase efficiency here?
* * Protected Sub gvITV_RowDataBo und(ByVal sender As Object, ByVal e
As System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles
gvITV.RowDataBo und
* * * * Dim nestedRepeater As Repeater =
TryCast(e.Row.F indControl("NR" ), Repeater)
* * * * If nestedRepeater IsNot Nothing Then
* * * * * * Dim x As HiddenField = e.Row.FindContr ol("hdnID")
* * * * * * Dim con As SqlConnection = New
SqlConnection(S ystem.Web.Confi guration.WebCon figurationManag er.ConnectionSt *rings("Connect ionString").ToS tring())
* * * * * * Dim sdap As SqlDataAdapter = New
SqlDataAdapter( "dbo.Fsn_WE B", con)
* * * * * * sdap.SelectComm and.CommandType =
CommandType.Sto redProcedure
* * * * * * sdap.SelectComm and.CommandTime out = 0
* * * * * * sdap.SelectComm and.Parameters. Add("new_id", SqlDbType.Int)
* * * * * * sdap.SelectComm and.Parameters. Item(0).Value = x.Value
* * * * * * con.Open()
* * * * * * Dim dt As Data.DataTable = New Data.DataTable
* * * * * * sdap.Fill(dt)
* * * * * * con.Close()
* * * * * * nestedRepeater. DataSource = dt
* * * * * * nestedRepeater. DataBind()
* * * * End If
* * End Sub
ASF,
Any luck on that? I'm in the same boat. I read in this article http://msdn.microsoft.com/en-us/library/aa992038.aspx where it mentions a
similar issue with nesting a gridview. It recommends caching for smaller
databases and using custom data object bound to an ObjectDataSourc e if your
database is large, but with no clear cut direction. I just posted to an www.asp.net forum if you want to follow the thread. http://forums.asp.net/t/1269591.aspx
If you found a good solution, please let me know!
"ASF" wrote:
Hey all,
I have a gridview which pulls from a BLL which pulls from a DAL
(an .XSD file). Each row on that gridview has a nested repeater which
pulls from another table. The code which populates each nested
repeater is shown below (it's in the gridview's RowDataBound event).
My question is this: what can I do to speed up this process? Currently
EVERY time a new gridview row is generated the code reaches out to the
database, grabs the specific records for the nested repeater, and
closes the connection. This can be a huge overhead if many master
records are displayed.
Naturally my inclination is to grab ALL the records needed in one
database pull and then relate them in the codebehind, but I'm not sure
how to accomplish this given the current structure (with a DAL and
all).
Does anyone have any suggestions to increase efficiency here?
Protected Sub gvITV_RowDataBo und(ByVal sender As Object, ByVal e
As System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles
gvITV.RowDataBo und
Dim nestedRepeater As Repeater =
TryCast(e.Row.F indControl("NR" ), Repeater)
If nestedRepeater IsNot Nothing Then
Dim x As HiddenField = e.Row.FindContr ol("hdnID")
Dim con As SqlConnection = New
SqlConnection(S ystem.Web.Confi guration.WebCon figurationManag er.ConnectionSt rings("Connecti onString").ToSt ring())
Dim sdap As SqlDataAdapter = New
SqlDataAdapter( "dbo.Fsn_WE B", con)
sdap.SelectComm and.CommandType =
CommandType.Sto redProcedure
sdap.SelectComm and.CommandTime out = 0
sdap.SelectComm and.Parameters. Add("new_id", SqlDbType.Int)
sdap.SelectComm and.Parameters. Item(0).Value = x.Value
con.Open()
Dim dt As Data.DataTable = New Data.DataTable
sdap.Fill(dt)
con.Close()
nestedRepeater. DataSource = dt
nestedRepeater. DataBind()
End If
End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tommy |
last post by:
I have been working on getting nested repeaters to work for several days.
When I add a repeater inside my item template i cannot see it in my code and
can't set the datasource for it, etc, thus it's useless.
Anytime i try to reference rptChild I get an error saying that it's not an
object. If I set a break point I see that it's <nothing>.
Here is a sample of code that shows the problem.
I would REALLY appreciate any help on getting...
|
by: mark |
last post by:
My problem is I need to have a "nested" repeater. I have an array which I
load into a hashtable - that part works great. I can setup the second
repeater to work just fine, as long as it's not nested within the first
repeater. If it is nested within the first repeater, I don't get any data.
If I put the second repeater as a separate repeater, not nested, it works
fine.
Here's my actual code, showing data pulled from the array within a...
|
by: Bojesphob |
last post by:
Can someone help? I
have a nested repeater in which I wish to format one of
the bits of data in currency. I know that the code for the
regular repeater (which works fine in parent) is
databinder.eval(Container.DataItem, "Net", "{0:c}") . BUT
I use that code in the nested repeater and IT DOES NOT
WORK!!!! In that code I have DataBinder.Eval
(Container.DataItem, "Reduction", "{0:c}") and the page
gives me the error "Error:...
|
by: Ed Allan |
last post by:
http://ejaconsulting.com/nestedrepeater/NestedRepeater.txt
>-----Original Message-----
>Doh! The HTML has all been rendered . . .
>
>Right click on this link and select 'Save target as ..'
>to get the code in a text file.
>
>Thanks - Ed
>
|
by: Maziar Aflatoun |
last post by:
Hi,
I have tried setting up a nested repeater control and it works fine. But
when I do 3 level nested repeater it fails. Does anyone know a site or have
an example of a three level nestest repeater control? Where there is a
parent repeater inside it there is a child repeater and inside that child
repeater there is another child repeater?
Repeater1 -> Repeater2 -> Repeater3?
| |
by: humbleFunGuy |
last post by:
What does nested controls mean in .Net? Any help is appreciated.
Thanks,
fanzi
|
by: mark |
last post by:
(not sure if this is the correct group)
My problem is I need to have a "nested" repeater. I have an array which I
load into a hashtable - that part works great. I can setup the second
repeater to work just fine, as long as it's not nested within the first
repeater. If it is nested within the first repeater, I don't get any data.
If I put the second repeater as a separate repeater, not nested, it works
fine.
Here's my actual code,...
|
by: mavrick_101 |
last post by:
Hi,
I have a nested repeater. For each row in the parent repeater there is a
child repeater with several rows of data.
The way I'm doing this is throught ItemDataBound Event. So for each Row in
parent repeater, when its ItemDataBound event is raised I grab the content of
the child repeater and DataBind it.
This makes the page load slower if there is more data.
|
by: =?Utf-8?B?SmFtZXMgR2V1cnRz?= |
last post by:
On my page, I have one repeater that contains a literal control and a nested
repeater. The nested repeater contains a literal control. Both repeaters
are databound with only one object (string). But... and this is the crappy
part, the nested repeater's events are fired twice. How do I know this? I
setup global private counter variables that get incremented on the repeater's
ItemDataBound event. The outer repeater is correct and only...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |