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

Tab render error in wizard

Hi,
I need to create a simple wizard so, I took the sample provided in documentation: https://ej2.syncfusion.com/aspnetmvc/documentation/tab/how-to/create-wizard-using-tab/
But, I am getting an error. It is attached in the image file.

Besides, I do not understand the line that creates the tab: @Html.EJS().Tab("ej2Tab").HeightAdjustMode(HeightStyles.None).Height("390").Created("tabCreated").Selecting("tabSelecting").Items(ViewBag.headeritems).Render()

The .Items parameter is "ViewBag.headeritems", however, there is no definition for that variable in the controller.

I need to create a wizard with 3 simple type of contents that I have built in partial views, and I can´t figure out how to build the Tab. 
Your help with that simple thing will be appreciated, I think with the sample provided I could infer the other things.

Kind regards,

Juan J. Uribe

Attachment: TabWizardExample_e8d47b74.zip

1 Reply

KK Karthigeyan Krishnamurthi Syncfusion Team February 25, 2019 12:21 PM UTC

Hi Juan José

 

Thanks for contacting Syncfusion support.


Query1: "Besides, I do not understand the line that creates the tab: @Html.EJS().Tab("ej2Tab").HeightAdjustMode(HeightStyles.None).Height("390").Created("tabCreated").Selecting("tabSelecting").Items(ViewBag.headeritems).Render().The .Items parameter is "ViewBag.headeritems", however, there is no definition for that variable in the controller."

We regret the inconvenience. The"ViewBag.headeritems" should be in the controller part. Please find more information in the below online demo sample.



Query2:"I need to create a wizard with 3 simple type of contents that I have built in partial views, and I can´t figure out how to build the Tab. 
Your help with that simple thing will be appreciated, I think with the sample provided I could infer the other things."

The recommended approach to load content as partial views in Tab is to use AJAX call that loads the content in the Tab on demand in the Created and Selected event of Tab as given below.   
  
  
@Html.EJS().Tab("MainTab").Created("tabCreated").Selected("tabSelected").Render()  
  
<script>  
    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.send().then();  
        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);  
            $("#GridOrder1").html(data);  
        }  
  
  
    }  
    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.send().then();  
            ajax.onSuccess = function (data) {  
                 
                $("#GridOrder2").html(data);  
  
                loaded = true;  
            }  
        }  
  
    }  
</script>  
  
 In this, we have created the Header and content both as dynamic. Hence if you don’t want to give as dynamic you can give it as direct items like the same way in that demo given. 
  
   
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/  
  
  
  

 

 
Regards, 
Karthigeyan 
   


Loader.
Live Chat Icon For mobile
Up arrow icon