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

How can I get the ID of the Grid component?

Thread ID:

Created:

Updated:

Platform:

Replies:

146800 Aug 20,2019 03:39 PM UTC Aug 22,2019 09:05 AM UTC Blazor 3
loading
Tags: Grid
doug kuchna
Asked On August 20, 2019 03:39 PM UTC

I can't seem to find a way to get the ID of the Grid Component.
Given the following grid
<EjsGrid DataSource="@Orders" @ref="@DefaultGrid" @ref:suppressField ID="test" Toolbar="@(new List<string>() { "Search" })" AllowPaging="true" AllowSorting="true" AllowResizing="true" AllowFiltering="true"
             AllowGrouping="true" AllowExcelExport="true" AllowPdfExport="true" ContextMenuItems="@MenuItems">
        <GridEvents TValue="SyncfusionBlazorTest.Data.Order" ContextMenuItemClicked="ItemClicked" Created="GridCreated" OnActionComplete="GridLoaded" DataBound="GridDataBound"></GridEvents><!--ContextMenuItemClicked="ItemClicked" OnPdfExport="PdfExport"-->
        <GridPageSettings PageSize=5></GridPageSettings>
    </EjsGrid>

I have tried getting the Id on
"Created"
"OnActionComplete" and
"DataBound" to no avail.


Thanks in advance

Doug Kuchna

Vignesh Natarajan [Syncfusion]
Replied On August 21, 2019 10:06 AM UTC

Hi Doug,  

Greetings from Syncfusion support.  

Query: “I can't seem to find a way to get the ID of the Grid Component. 

We are glad to announce that our latest Nuget release (17.2.46) has been successfully release and kindly find the latest Nuget package from below  


So kindly refer our latest Nuget package from nuget.org instead of private build. We suspect that you need to get the Grid instance using the ID to perform certain actions in Grid. We suggest you to take the Grid instance using @ref property of Grid. Refer the below code example. 

<EjsGrid DataSource="@Orders" @ref="@DefaultGrid" @ref:suppressField ID="test" AllowPaging="true"> 
………………………………………. 
    </EjsGrid> 
 
@code{ 
    EjsGrid<Order> DefaultGrid { get; set; } 
    public List<Order> Orders { get; set; } 
    ……………………………….. 
    public void GridLoaded(ActionEventArgs<Order> Args) 
    { 
        DefaultGrid.AddRecord();    //DefaultGrid is the instance of the grid. You can call the public method from it. 
    } 
    public void GridDataBound() 
    { 
 
    } 
    ……………………………….. 
} 

If above solution does not resolve your query, please get back to us with more details of your requirement.   

Regards,
Vignesh Natarajan. 


doug kuchna
Replied On August 21, 2019 10:34 AM UTC

Thank you much, this resolves my issue

Vignesh Natarajan [Syncfusion]
Replied On August 22, 2019 09:05 AM UTC

Hi Doug, 

Thanks for the update.  

We are happy to hear that your query has been resolved by our solution.  

Please get back to us if you have any further queries. 

Regards, 
Vignesh Natarajan. 


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