"codeless" nested gridviews...there has to be a better way

R

Roy

Hey all. Below is the nested syntax on how to make a "codeless" nested
gridview embedded within another gridviews templatefield column. Only
problem is that it loads slow. REAL SLOW. There has to be a better way.
Suggestions anyone? By the way, I'm not opposed to coding, it just
seems like this should be easily doable on the aspx side of things.

Summary:
I'm stuffing the 3 three key fields from each row in the master
gridview into invisible labels, then pulling that data from them into
the nested sqldatasource which is in turn bound to the nested gridview.

Code:


<asp:TemplateField>
<ItemTemplate>

<asp:Label ID="t1" runat="server" Text='<%#Eval("van") %>'
Visible="false" />
<asp:Label ID="t2" runat="server" Text='<%#Eval("tcon") %>'
Visible="false" />
<asp:Label ID="t3" runat="server" Text='<%#Eval("carr") %>'
Visible="false" />

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:pATConnectionString %>"
SelectCommand="ww_nested" SelectCommandType="storedprocedure">
<SelectParameters>
<asp:ControlParameter ControlID="t1" Name="van" Type="string" />
<asp:ControlParameter ControlID="t2" Name="tcon" Type="string" />
<asp:ControlParameter ControlID="t3" Name="carr" Type="string" />
</SelectParameters>
</asp:SqlDataSource>

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
DataSourceID="sqldatasource1" DataKeyNames="UID" AllowPaging="false"
AllowSorting="false">
<Columns>
<asp:BoundField DataField="UID" HeaderText="UID" ReadOnly="True"
Visible="false"/>
<asp:BoundField DataField="EVENT_DESCRIPTION" HeaderText="Event
Description" />
<asp:BoundField DataField="Event" HeaderText="Event" />
<asp:BoundField DataField="EventDt" HeaderText="EventDt" />
<asp:BoundField DataField="EventLocation" HeaderText="Location" />
<asp:BoundField DataField="ShipName" HeaderText="Ship Name" />
</Columns>
</asp:GridView>

</ItemTemplate>
</asp:TemplateField>
 
R

Roy

Doh.
Forgot to index the three fields in SQL Server. Having done that the
load times are now within acceptable limits. :) Though if anyone has
any tips to streamline or speed up the code, please let me know!
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top