Results 1 to 5 of 5

Thread: [RESOLVED] Accordion with Master Detail

  1. #1

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Resolved [RESOLVED] Accordion with Master Detail

    I have an accordion AJax Toolkit control which at header level displays a list of categories from datatable1 (a distinct list of categories) , and in the content section I want to display the details (possibly in a grid) from datatable2 (a list of all products and detail including category).
    There are plenty of tutorials on how to achieve this.

    However the tricky part is that I don't want to re-query the database on opening each header. I would rather the data is pre-filled for each detail section based on the category and just gets displayed.

    What would be the best approach to this?

  2. #2

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Re: Accordion with Master Detail

    Im thinking along these lines at the moment but it cant find the hidden field in the header
    protected void Accordion1_ItemDataBound(object sender, AjaxControlToolkit.AccordionItemEventArgs e)
    {
    if (e.AccordionItem.ItemType == AjaxControlToolkit.AccordionItemType.Content)
    {
    GridView detailgrd = (GridView)e.AccordionItem.FindControl("gvwDelegates");
    DataTable table = ds.Tables["Courses1"];
    string expression;
    HiddenField hidCusType = (HiddenField)e.AccordionItem.FindControl("hidCusType");
    expression = "EventNumber=" + hidCusType.Value;
    DataRow[] foundRows;
    foundRows = table.Select(expression);
    detailgrd.DataSource = foundRows;
    // Use the Select method to find all rows matching the filter.

    }
    }

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Accordion with Master Detail

    As this seems to be .Net based, thread moved from the 'ASP, VB Script' forum to the 'ASP.Net' forum

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Accordion with Master Detail

    Haven't done runtime accordion binding so a few suggestions.
    You can use page load and inside a not page.ispostback bring the desired data, then fill the accordion with it.
    You can use a web service and bind the data to the accordion with jquery. You must know the ajax equivalents for the accordion binding here, if i am not mistake, so it may be a little hard.
    What you do, but, If the hidden field you seek is just a number to index the desired data then you can put that in session and get it from there, since you are querying on the server side anyhow.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  5. #5

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Re: Accordion with Master Detail

    Ok I originally had the hidden field in the header, moving it into the content seemed to fix the issue.
    <asp:Accordion ID="Accordion1" runat="server" SelectedIndex="0"


    AutoSize="None"
    FadeTransitions="true"
    TransitionDuration="100"
    SuppressHeaderPostbacks = "true"
    OnItemDataBound="Accordion1_ItemDataBound"
    CssClass="accordion"
    HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected"
    ContentCssClass="accordionContent"
    Height="100%"
    >



    <HeaderTemplate>

    <table class="delegatestbl"><tr><td width="150px;"><%#DataBinder.Eval(Container.DataItem, "CourseCode")%> </td><td width="350px;"> <%#DataBinder.Eval(Container.DataItem, "CourseTitle")%></td><td width="200px"> <%#DataBinder.Eval(Container.DataItem, "MainRoom")%></td><td width="150px"> <%#DataBinder.Eval(Container.DataItem, "Trainer")%></td></tr></table>





    </HeaderTemplate>

    <ContentTemplate> <asp:HiddenField runat="server" id="hidCusType" value='<%#DataBinder.Eval(Container.DataItem, "EventNumber")%>' />
    <asp:GridView ID="gvwDelegates" runat="server"
    DataKeyNames="EventNumber" AutoGenerateColumns="false" CssClass="dgrid">
    <Columns>
    <asp:BoundField HeaderText="Delegate Name" DataField="DelegateName" />
    <asp:BoundField HeaderText="Organisation" DataField="Cust_Name" />
    <asp:BoundField HeaderText="Booking No." DataField="Booking_BookingNumber" />
    </Columns>
    <EmptyDataTemplate>No delegates found.</EmptyDataTemplate>
    </asp:GridView>

    </ContentTemplate>

    </asp:Accordion>
    </div></ContentTemplate>
    </asp:UpdatePanel>
    </div>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width