We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Databind


How to bind the data in accordion.I want to create a accordion with items dynamically and add controls dynamically from database, there anyway to do this?

3 Replies

KR Keerthana Rajendran Syncfusion Team May 22, 2017 02:43 PM UTC

Hi Jaime, 
 
Thank you for contacting Syncfusion support 
 
We have prepared a sample in Accordion. In order to add items dynamically to accordion we suggest you to use addItem method of Accordion 
 
@Html.EJ().Button("button1").ClientSideEvents(e => e.Click("OnChange")).Text("Add Item"); 
 
function OnChange() 
        { 
           
            var TermDetailContent = [{ "ID": "Header1", "Description": "Content1" }]; 
            var accObj = $("#contentAccordion").data("ejAccordion"); 
            
            for (var j = 0; j < TermDetailContent.length; j++) { 
                        
                 var item = TermDetailContent[j]; 
                 accObj.addItem(item.ID, item.Description, j); 
                            } 
            } 
 
Sample Link: Sample2015534317.zip 
 
 
 
 
Regards, 
Keerthana. 



JA jaime May 22, 2017 10:39 PM UTC

Thanks a lot for the example

Regards


KR Keerthana Rajendran Syncfusion Team May 23, 2017 04:33 AM UTC

Hi Jaime, 
 
Thanks for your update. Please get back to us if you require any further assistance on this. We will be happy to assist you 
 
Regards, 
Keerthana. 


Loader.
Live Chat Icon For mobile
Up arrow icon