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

Discussion in 'ASP .Net' started by Roy, Jun 16, 2006.

  1. Roy

    Roy Guest

    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>
     
    Roy, Jun 16, 2006
    #1
    1. Advertising

  2. Roy

    Roy Guest

    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!
     
    Roy, Jun 16, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guadala Harry

    Nested DIVs - is there a better way?

    Guadala Harry, Oct 26, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    496
    Guadala Harry
    Oct 26, 2004
  2. Rob R. Ainscough
    Replies:
    42
    Views:
    1,013
  3. Replies:
    0
    Views:
    4,797
  4. Chris

    Nested Gridviews

    Chris, Apr 1, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    448
    Chris
    Apr 1, 2007
  5. Michael Barinek

    there has got to be a better way...

    Michael Barinek, Jul 25, 2006, in forum: Ruby
    Replies:
    6
    Views:
    285
    Dave Howell
    Jul 26, 2006
Loading...

Share This Page