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

Accesing row data when RecordDoubleClick event is fired

Thread ID:

Created:

Updated:

Platform:

Replies:

147707 Sep 20,2019 03:56 PM UTC Sep 23,2019 06:52 AM UTC Blazor 2
loading
Tags: Grid
Emilio
Asked On September 20, 2019 03:56 PM UTC

Can you extend the example referred to this event to know how to access data of the selected row?
@using Syncfusion.EJ2.Blazor.Grids

<EjsGrid DataSource="@Orders">
    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"                   Mode="EditMode.Normal"></GridEditSettings>
    <GridEvents OnRecordDoubleClick="RecordDoubleClickHandler" TValue="Order"></GridEvents>
    <GridColumns>
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
        <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="yMd" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
    </GridColumns>
</EjsGrid>

@code{
    public List<Order> Orders { get; set; }

    protected override void OnInitialized()
    {
        Orders = Enumerable.Range(1, 75).Select(x => new Order()
        {
            OrderID = 1000 + x,
            CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
            Freight = 2.1 * x,
            OrderDate = DateTime.Now.AddDays(-x),
        }).ToList();
    }

    public class Order {
        public int? OrderID { get; set; }
        public string CustomerID { get; set; }
        public DateTime? OrderDate { get; set; }
        public double? Freight { get; set; }
    }

    public void RecordDoubleClickHandler(RecordDoubleClickEventArgs<Order> args)
    {
        // Here you can customize your code
    }
}
For example how to get the selected value of the CustomerId inside REcordDobubleClickHand.

Thank you for your help


Emilio
Replied On September 21, 2019 06:38 PM UTC

I respond myself

"For example how to get the selected value of the CustomerId inside REcordDobubleClickHand."

  public void RecordDoubleClickHandler(RecordDoubleClickEventArgs<Order> args)
    {
        NavigationManager.NavigateTo("/detailPage/" + args.RowData.CustomerId);
}



Vignesh Natarajan [Syncfusion]
Replied On September 23, 2019 06:52 AM UTC

Hi Emilio,  

Greetings from Syncfusion support. 

Query: “ For example how to get the selected value of the CustomerId inside REcordDobubleClickHand. && I respond myself 
 
Yes, you can get the clicked row details from OnRecordDoubleClick events arguments itself. We are glad to hear that you have resolved your query by yourself. Please get back to us if you have 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