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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Tab render error in wizard

Thread ID:

Created:

Updated:

Platform:

Replies:

142843 Feb 21,2019 04:15 PM UTC Feb 25,2019 12:21 PM UTC ASP.NET MVC - EJ 2 1
loading
Tags: Tab
Juan José
Asked On February 21, 2019 04:15 PM UTC

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

Karthigeyan Krishnamurthi [Syncfusion]
Replied On 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 
   


CONFIRMATION

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