This article explains how to create an accordion dynamically in ASP.NET.
Introduction It's a control in the Ajax tool kit by which you can add sections with some content separately and expand or collapse each section as needed. I will explain how to bind the Accordion with database values and add it on the page dynamically. To do it you need to create a table in your database and add some data into it for each section's header and content.To better understand, use the following procedure to create a sample.Step 1
Create a table named "BTechStudents" with 2 fields named "BranchName" and "StudentName". Step 2
Insert some data into the table.
Step 3
Download the AjaxCOntrolToolKit from the following link to use the Accordion control.And create a website named "Test_Website".Right-click on the website and choose "Add reference" to add the reference of AjaxControlToolkit.A window will be shown to add the reference. Use the following sub-steps to add the AjaxControlToolKit.
It will look as in the following bin folder:Step 4
Step 5
Now I will provide some sub-steps for creating the Accordion.
Write the following code on the Page Load event of the page and add the following namespaces to the page.
ASP.NET MVC 5: A Beginner’s Guide