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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Synfusion controls within content rendered within a Synfusion Tab control

Thread ID:





141730 Dec 31,2018 12:30 PM UTC Jan 2,2019 10:18 AM UTC ASP.NET MVC - EJ 2 1
Tags: Tab
Charles Southey
Asked On December 31, 2018 12:30 PM UTC

Hi - I'm using the tab control with content that gets rendered from CSHTML partial views. All works fine, except that for any content that contains other SyncFusion controls the script block created by @Html.EJS().ScriptManager() is causing problems. If I render it within the partial view it causes an error (Invalid Token) - if I leave the @Html.EJS().ScriptManager() off and rely on the one in _Layout it won't realise it needs to render code for those controls within the partial view.
I've tried manipulating the rendered partial content using Regex to extract the script block and add it later - but I can't get it to consistently run at the right time.
What is your recommendation w.r.t. rendering content within a Tab control that contains other Syncfusion controls?

Prince Oliver [Syncfusion]
Replied On January 2, 2019 10:18 AM UTC

Hi Charles, 
Thank you for using Syncfusion products. 
Query1:” What is your recommendation w.r.t. rendering content within a Tab control that contains other Syncfusion controls?” 
The recommended approach to load content in Tab is to use AJAX call that loads the content in the Tab on demand in the Created and Selected event of Tab. Kindly refer to the following code snippet.   
    var loaded = false;  
    function tabCreated(e) { // created event to create the Tab items and data for first tab   
        var tabObj = document.getElementById("MainTab").ej2_instances[0];  
        var ajax = new ej.base.Ajax('@Url.Action("PartialView1""Home")''GET'true);  
        ajax.onSuccess = function (data) {  
            tabObj.addTab([{ header: { 'text''Grid1' }, "content""<div id='GridOrder1'></div>" }],0);  
            tabObj.addTab([{ header: { 'text''Grid2' }, "content""<div id='GridOrder2'></div>" }],1);  
    function tabSelected(e) { // selected event to load data dynamically based on the selection of the tab item   
        if(e.selectedIndex != 0 && !loaded){  
            var tabObj = document.getElementById("MainTab").ej2_instances[0];  
            var ajax = new ej.base.Ajax('@Url.Action("PartialView2""Home")''GET'true);  
            ajax.onSuccess = function (data) {                  
                loaded = true;  
In our example, we have created both the Header and content as dynamic. if you don’t want to set them as dynamic, then you can directly set the items in the same way we given in the example. 
We have attached the sample for your reference, please find the sample at the following link: http://www.syncfusion.com/downloads/support/directtrac/222473/ze/WebApplication2-753147216   
We have also explained the diverse ways to load Tab content in the below help pages:  
2.      From the items within same page or new Items:  https://ej2.syncfusion.com/documentation/tab/how-to/load-tab-items-dynamically/   
Kindly check the above help links and get back to us if you face any difficulties in achieving your requirement. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon