Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148829 | Nov 5,2019 08:29 PM UTC | Feb 3,2020 10:16 AM UTC | Blazor | 6 |
![]() |
Tags: Tabs |
@using Syncfusion.EJ2.Blazor.Navigations
@using Syncfusion.EJ2.Blazor.Buttons
<EjsTab @ref="sourceTab" CssClass="e-fill" EnableRtl="true" OverflowMode="OverflowMode.Scrollable" HeightAdjustMode="HeightStyles.None" Height="390px" ShowCloseButton="false">
<TabEvents></TabEvents>
<TabItems @ref="@TabItems1">
<TabItem @ref="@a">
<ChildContent>
<TabHeader Text="aaaaaaa"></TabHeader>
</ChildContent>
<ContentTemplate>
<p>@AContent</p>
</ContentTemplate>
</TabItem>
<TabItem @ref="@b" Content="bbbbbbb">
<ChildContent>
<TabHeader Text="bbbbbbbbb"></TabHeader>
</ChildContent>
<ContentTemplate>
<p>@BContent</p>
</ContentTemplate>
</TabItem>
<TabItem @ref="@c" Content="cccccc">
<ChildContent>
<TabHeader Text="cccccccccccc"></TabHeader>
</ChildContent>
<ContentTemplate>
<p>@CContent</p>
</ContentTemplate>
</TabItem>
</TabItems>
</EjsTab>
<EjsButton ID="NextButton1" @onclick="@add" IsPrimary="true" Content="add"></EjsButton>
<EjsButton ID="NextButton" @onclick="@remove" IsPrimary="true" Content="remove"></EjsButton>
<EjsButton ID="NextButton111" @onclick="@next" IsPrimary="true" Content="next"></EjsButton>
<EjsButton ID="NextButton1212" @onclick="@back" IsPrimary="true" Content="back"></EjsButton>
@code{
EjsTab sourceTab;
TabItem a;
TabItem b;
TabItem c;
TabItems TabItems1;
List<TabItem> f = new List<TabItem>();
List<TabItem> Removed = new List<TabItem>();
string BContent = "bbbbbbbbbb";
string AContent = "aaaaaaa";
string CContent = "cccccccccccccc";
public void add(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
{
if (Removed.Contains(b))
{
if (!f.Contains(b))
{
b.Content = BContent;
a.Content = AContent;
c.Content = CContent;
f.Add(b);
sourceTab.AddTab(f, 1);
Removed.Remove(b);
}
}
}
public void remove(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
{
if (!Removed.Contains(b))
{
Removed.Add(b);
f.Remove(b);
sourceTab.RemoveTab(sourceTab.Items.IndexOf(b));
}
}
public void next(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
{
int s = Convert.ToInt32(sourceTab.SelectedItem);
sourceTab.Select(s + 1);
}
public void back(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
{
int s = Convert.ToInt32(sourceTab.SelectedItem);
sourceTab.Select(s - 1);
}
}
|
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RenderTab</title>
<base rel='nofollow' href="~/" />
<link rel="stylesheet" rel='nofollow' href="css/bootstrap/bootstrap.min.css" />
<link rel='nofollow' href="css/site.css" rel="stylesheet" />
</head> |
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.
This page will automatically be redirected to the sign-in page in 10 seconds.