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 and iFrame

I have a tab and I need to create tabs dynamically. It works correctly, I pass a URL in the creation of each tab in the ASP.NET MVC project.

Is it correct or should I use an iframe to load it separately from each index in my project. If the best option is the iframe, how can I use it?

1 Reply

PO Prince Oliver Syncfusion Team August 7, 2017 12:33 PM UTC

Hi Luciano, 

Thank you for contacting Syncfusion support. 

Yes, it is correct to pass URL in the creation of each tab, this will render the content from the URL in the tab item. So there is no need to using an <iframe> inside tab control. You can also use AJAX to create and load the tab item dynamically. Kindly refer to the following code snippet. 

<div style="width: 500px"> 
    @{Html.EJ().Tab("URLTab").Items(data => 
        { 
            data.Add().ID("URLTabQuickList").Text("Quick List").Url("../Content/QuickListTabContent.html"); 
        }).Render();} 
</div> 
<input type="button" value="addItem" id="item"/> 
<script> 
    $(function () { 
        $("#item").on("click", function () { 
            $.ajax({ 
                url: '../Content/PartsTabContent.html', 
                datatype: "html", 
                success: function (data) { 
                    var tabObj = $("#URLTab").data("ejTab"); 
                    tabObj.addItem("#URLTabParts", "Parts", 1); 
                    $('#URLTabParts').html(data); 
                } 
 
            })  
        }); 
    }); 
        
</script> 


Regards, 
Prince 


Loader.
Up arrow icon