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

Accordion for version 17.3.29.

I'm starting to believe that these sample codes are written for v17.4.x.x, am I correct. Do you still have sample code for 17.3.29, it's actually the one I'm using for now and I don't have a reference for that version. Thank you.

@using Syncfusion.EJ2.Blazor.Navigations

<EjsAccordion DataSource="@AccordionItems" ModelType="@typeof(AccordionData)">
    <AccordionTemplates>
        <HeaderTemplate>
            <div>@((context as AccordionData).EmployeeName)</div>
        </HeaderTemplate>
        <ItemTemplate>
            @{
                AccordionData ContextData = context as AccordionData;
                <div>
                    <div><b>Employee ID: </b>@ContextData.EmployeeId</div>
                    <div><b>Designation: </b>@ContextData.Designation</div>
                </div>
            }
        </ItemTemplate>
    </AccordionTemplates>
</EjsAccordion>

@code{
    List<AccordionData> AccordionItems = new List<AccordionData>()
{
            new AccordionData
            {
            EmployeeId = 1,
            EmployeeName = "Laura Callahan",
            Designation = "Product Manager",
            },
            new AccordionData
            {
            EmployeeId = 3,
            EmployeeName = "Andrew Fuller",
            Designation = "Team Lead",
            },
            new AccordionData
            {
            EmployeeId = 4,
            EmployeeName = "Anne Dodsworth",
            Designation = "Developer"
            },
            new AccordionData
            {
            EmployeeId = 5,
            EmployeeName = "Nancy Davolio",
            Designation = "Product Manager"
            }
    };

    public class AccordionData
    {
        public string EmployeeName { get; set; }
        public int EmployeeId { get; set; }
        public string Designation { get; set; }
    }
}

d

1 Reply

AK Alagumeena Kalaiselvan Syncfusion Team February 7, 2020 04:46 AM

Dear Customer, 

Thanks for contacting Syncfusion support! 

Yes, the current user guide document reflects the 17.4 release version. You can use the Accordion ModelType as Object instead of System.Type for the specified version “V17.3.29”. Refer below code for that 

@using Syncfusion.EJ2.Blazor.Navigations 
 
<EjsAccordion DataSource="@AccordionItems" ModelType="AccordionModel"> 
    <AccordionTemplates> 
        <HeaderTemplate> 
            <div>@((context as AccordionData).EmployeeName)</div> 
        </HeaderTemplate> 
        <ItemTemplate> 
            @{ 
                AccordionData ContextData = context as AccordionData; 
                <div> 
                    <div><b>Employee ID: </b>@ContextData.EmployeeId</div> 
                    <div><b>Designation: </b>@ContextData.Designation</div> 
                </div> 
            } 
        </ItemTemplate> 
    </AccordionTemplates> 
</EjsAccordion> 
 
@code{ 
    AccordionData AccordionModel = new AccordionData(); 
    List<AccordionData> AccordionItems = new List<AccordionData>() 
{ 
            new AccordionData 
            { 
            EmployeeId = 1, 
            EmployeeName = "Laura Callahan", 
            Designation = "Product Manager", 
            }, 
            new AccordionData 
            { 
            EmployeeId = 3, 
            EmployeeName = "Andrew Fuller", 
            Designation = "Team Lead", 
            }, 
            new AccordionData 
            { 
            EmployeeId = 4, 
            EmployeeName = "Anne Dodsworth", 
            Designation = "Developer" 
            }, 
            new AccordionData 
            { 
            EmployeeId = 5, 
            EmployeeName = "Nancy Davolio", 
            Designation = "Product Manager" 
            } 
    }; 
 
    public class AccordionData 
    { 
        public string EmployeeName { get; set; } 
        public int EmployeeId { get; set; } 
        public string Designation { get; set; } 
    } 
} 

Also you can download this sample by the following link 

Kindly get back to us, if you need further assistance 

Regards 
Alagumeena.K 


Loader.
Live Chat Icon For mobile
Up arrow icon