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

Add hyperlink to a column without CommandColumn

Thread ID:

Created:

Updated:

Platform:

Replies:

150809 Jan 21,2020 01:23 AM UTC Jan 21,2020 06:40 AM UTC Blazor 1
loading
Tags: Grid
Anthony
Asked On January 21, 2020 01:23 AM UTC

Is it possible to add an onClick event to a row cell without using a command column?   I want to show a name of a user in a column but be able to open a dialog when the name is clicked?

Vignesh Natarajan [Syncfusion]
Replied On January 21, 2020 06:40 AM UTC

Hi Anthony,  
 
Greetings from Syncfusion support.  
 
Query: “I want to show a name of a user in a column but be able to open a dialog when the name is clicked? 
 
We suggest you to achieve your requirement using Column Template of EjsGrid. Using column template you can render custom component inside the Grid column. We suggest you to render a Span element with click event bounded to it. Refer the below code example.   
 
<EjsGrid DataSource="@Employees"> 
    <GridColumns> 
        <GridColumn Field="FirstName" HeaderText="Employee Name" TextAlign="TextAlign.Center" Width="120"> 
            <Template> 
                @{ 
                    <span @onclick="Clicked">@(context as EmployeeData).FirstName</span> 
                } 
            </Template> 
        </GridColumn> 
. . . . . .. . .  
    </GridColumns> 
</EjsGrid> 
@code{ 
    public List<EmployeeData> Employees { get; set; } 
    public void Clicked(MouseEventArgs Args) 
    { 
        // perform your action here, open a dialog here 
    } 
 
Note: To perform data operations in that column, kindly define Field property of grid column similar to column name.  
 
Refer our UG documentation for your reference 
 

Kindly 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