Unable to access TabEvents programatically.

Hello,

Searching on the code and the documentation I am not able setup a TabEvent member by code.

Regards,

Brice.

7 Replies

AK Alagumeena Kalaiselvan Syncfusion Team April 20, 2020 12:34 PM UTC

Hi Brice, 

Greetings from Syncfusion support! 

We have validated your scenario “Unable to access TabEvents programmatically” and you can define the events inside the TabEvents element. We will include the Tab Events related sample in documentation site for our upcoming patch release. Refer the below code for that. 

<SfTab> 
    <TabEvents Selecting="OnSelecting"></TabEvents>  // Define the Tab events 
        <TabItems> 
            <TabItem> 
                <ChildContent> 
                    <TabHeader Text="HTML"></TabHeader> 
                </ChildContent> 
                <ContentTemplate> 
                    <div>HyperText Markup Language, commonly referred to as HTML, is the standard markup language used to create web pages.</div> 
                </ContentTemplate> 
            </TabItem> 
            <TabItem> 
                <ChildContent> 
                    <TabHeader Text="Java"></TabHeader> 
                </ChildContent> 
                <ContentTemplate> 
                    <div>Java is a set of computer software and specifications developed by Sun Microsystems, later acquired by Oracle Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment.</div> 
                </ContentTemplate> 
            </TabItem> 
            <TabItem> 
                <ChildContent> 
                    <TabHeader Text="JavaScript"></TabHeader> 
                </ChildContent> 
                <ContentTemplate><div>JavaScript (JS) is an interpreted computer programming language. It was originally implemented as part of web browsers so that client-side scripts could interact with the user, control the browser, communicate asynchronously, and alter the document content that was displayed.</div></ContentTemplate> 
            </TabItem> 
        </TabItems> 
</SfTab> 
<div class="log-section"> 
    <pre>@Output</pre> 
</div> 
 
 
@code{ 
 
    private string Output = ""; 
 
    /* Created Event */ 
 
    public void OnSelecting()    
    { 
        Output = Output + "\n\n Tab selecting event start\n\n" + "\n\n Tab selecting event end\n\n"; // Triggers while selecting Tab 
    } 
 
} 

 

Also, you can download this sample using the below link 

Note: Refer the below link to know further details of TabEvents 
 


Kindly try with shared sample and get back to us, If you need any further assistance. 

Regards 
Alagumeena.K 



BF Brice FROMENTIN April 20, 2020 12:42 PM UTC

Hello,

Sorry, I mean by code something like that :

code
{
    StTab Tabs

    void somefunctuion()
    {
          Tabs.TabEvents.OnSelecting . ......


Is it mor clear now ?


Brice.



AK Alagumeena Kalaiselvan Syncfusion Team April 21, 2020 01:38 PM UTC

Hi Brice, 

Thanks for your update. 

Currently the requirement “How to access tab events programmatically” is not feasible with Tab and you can programmatically access the public methods alone instead of events. Refer the below code for that. 

@code{ 
 
    SfTab Tabs; 
 
    public void OnSelecting() 
    { 
        Tabs.Select(1);  // To select Tab Item programmatically 
    } 
 
} 


Regards 
Alagumeena.K  



BF Brice FROMENTIN April 21, 2020 01:40 PM UTC

Thanks for your answer, is it possible to create a change request for this feature ?


AK Alagumeena Kalaiselvan Syncfusion Team April 22, 2020 03:20 PM UTC

Hi Brice, 

Thanks for your update. 

We have checked with your requirement and the provided details not sufficient to understand your requirement. So, can you please share your exact scenario with more details to access the Tab events programmatically. Based on the scenario, we will assist you better. 

Regards 
Alagumeena.K 



BF Brice FROMENTIN April 22, 2020 03:43 PM UTC

Hello,

I created a new base class for my ComponentBase one, This class automates lots of common code, in this base class I cant to be able to write in pure C# something like that :

function()
{
     Tabs.TabEvents.OnSelecting = MyDelegate

}

Regards


AK Alagumeena Kalaiselvan Syncfusion Team April 24, 2020 02:34 PM UTC

Hi Brice, 

Thanks for your update. 

We have checked the feasibility of your requirement “Configure Tab events by Code”. But, we regret to let you know that your requirement is not possible with Blazor platform. We will consider your requirement as a feature request if it is possible.  

Regards 
Alagumeena.K 


Loader.
Up arrow icon