Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 943031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:22:16+00:00 2026-05-15T22:22:16+00:00

I am trying to databind a DataTable to an accordion and I have found

  • 0

I am trying to databind a DataTable to an accordion and I have found that If I retrieve the DataTable from a database using a table adapter it binds to the accordion perfectly however what I want to do is create a dummy table (for testing purposes if I don’t have access to my database) the code to create the dummy table is below:

    DataTable table2 = new DataTable("articletable");
    table2.Columns.Add("articleID");
    table2.Columns.Add("title");
    table2.Columns.Add("content");

    DataRow row = table2.NewRow();
    row[0] = "1";
    row[1] = "article name";
    row[2] = "article contents go here";
    table2.Rows.Add(row);

When I try to data bind that table however the accordion does not display. I can bind it to a gridview or detailsview but not the accordion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:22:16+00:00Added an answer on May 15, 2026 at 10:22 pm

    After 4 hours of banging my head against the wall, I discovered that the DataSource field is VERY picky.

    Here’s my code:

    DataSet ds = new DataSet();
    
            DataTable dt = new DataTable();
            dt.Columns.Add("Name");
            dt.Columns.Add("Branch");
            dt.Columns.Add("Officer");
            dt.Columns.Add("CustAcct");
            dt.Columns.Add("Grade");
            dt.Columns.Add("Rate");
            dt.Columns.Add("OrigBal");
            dt.Columns.Add("BookBal");
            dt.Columns.Add("Available");
            dt.Columns.Add("Effective");
            dt.Columns.Add("Maturity");
            dt.Columns.Add("Collateral");
            dt.Columns.Add("LoanSource");
            dt.Columns.Add("RBCCode");
    
            dt.Rows.Add(new object[] { "James Bond, LLC", 120, "Garrison Neely", "123 3428749020", 35, "6.000", "$24,590", "$13,432",
                "$12,659", "12/13/21", "1/30/27", 55, "ILS", "R"});
    
            ds.Tables.Add(dt);
    
            accReportData.DataSourceID = null;
            accReportData.DataSource = ds.Tables[0].DefaultView;
            accReportData.DataBind();
    

    Turns out that the accordion only likes being bound to a dataset table’s defaultview. I tried binding to just a DataTable (dt) and it failed. Even dt.DefaultView failed. Once I added it to a DataSet, it binds like a champ. Very annoying, with lost of wasted time. I know you’ve probably long-since forgotten this, but I wanted to make it available to future searchers. Accordion.DataSource must be bound to a DataSet.Table.DefaultView to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to retrieve a list of dropdown items from the database. The
I'm using MVVM and am trying to databind the Source property of Image to
I am trying to databind a DataGridView to a list that contains a class
In asp.net, i am trying to filter the data in datatable for that i
i have an gridview that retrieves the data via a datatable like this: protected
I'm trying to add nodes from a dataTable into a treeview. My problem isn't
Currently i am trying to export the data from the data table to the
I am trying to get a gridview to populate text from the database call
Im trying to display name, description and a picture from my database with a
I am trying to databind this query. cboTypeStage.DataSource = ( from ts in tsRepository.GetTable()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.