By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 990 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

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

P: n/a
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>

Jun 16 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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!

Jun 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.