nested datalist vs tablecontrol for display of data - novice question

J

Joey

Hi There,

I have an application in which i'm using nested datalists to display data, I
call an OnItemDataBound event to display data based on the rows returned
from the 2nd list (dlistcolour) , I am facing some performance issues as I
use a sql statment for each list so I can acheive the display I want (see
below), I'm wondering if the performance will be increased if I use a
datareader & a table to display the data? Could someone tell me the best wat
to acheive this, without the perfomance hit.

Joey - thanks in advance

--output

Datalist1 | value | value | value
dtlistsColour |value | dtlistqoh | value | value | value
value
--------
value
-------

<asp:datalist id="Datalist1" runat="server" ShowFooter="True"
HorizontalAlign="Center" Font-Size="11pt" Font-Name="Verdana"
repeatdirection="Horizontal"
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "size") %>
</ItemTemplate>
</asp:datalist>
<asp:datalist id="dtlistsColour" runat="server" ItemStyle-Height="20"
HorizontalAlign="left" Font-Size="11pt" Font-Name="Verdana"
OnItemDataBound="BuildqohGrid" BorderStyle="Solid" Width="100%">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "colourdesc") %>
<asp:datalist id="dtlistqoh" RepeatDirection="Horizontal"
runat="server" Font-Name="Verdana" Font-Size="11pt" HorizontalAlign="Right"
ItemStyle-VerticalAlign="top" ItemStyle-Width="20">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "qoh") %>
</ItemTemplate>
</asp:datalist>
</ItemTemplate>
</asp:datalist>
 
S

Sahil Malik

Joey,

When you say "I use a sql statement for each list". Do you fill your dataset
(or whichever bindable business object you are using), for the inner nested
list EVERYTIME it is rendered?

If yes, then therein lies your problem. An alternate way would be to fill in
a dataset with two tables, setup a relation between them, and use the
GetChildRows method to do the connection without going to the d/b.

DataReader would be faster for a single user scenario, but in this
situation, I am almost inclined to advise using a dataset instead, since
DataReader doesn't pool that well. .. okay let me explain taht further ..

The connection will not pool until you close it. If you use datareader, your
connection time open will be --> Time to draw the list + time to read data.
If you use dataset, the time will be --> Time to fill dataset/read data.

Time to fill dataset < Time to draw the list.

Therefore prefer to use dataset.

- Sahil Malik
You can reach me thru my blog at
http://www.dotnetjunkies.com/weblog/sahilmalik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top