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. Image for the cookie policy date

Get data row or cell from grid when click on command button

Hi,
I  have a grid with command in column, and I need to get a cell value from row where button clicked. 
this is my grid 

Html:
@{
    List<object> comandos = new List<object>();
    comandos.Add(new { type = "email", buttonOption = new { content = "", cssClass = "e-flat", iconCss = "e-mail e-icons" } });
}
@Html.EJS().Grid("grdBeneficiarios").DataSource(dataManager => { dataManager.Json(Model.ToArray()).InsertUrl("/Contrato/AgregarBeneficiario").RemoveUrl("/Contrato/EliminarBeneficiario").UpdateUrl("/Contrato/ActualizarBeneficiario").Adaptor("RemoteSaveAdaptor");}).ActionBegin("actionBegin").Columns(col =>
{
    col.Field("IdBeneficiario").IsPrimaryKey(true).IsIdentity(true).Visible(false).Add();
    col.Field("IdTiposIdentificacion").HeaderText("Tipo id").ForeignKeyField("IdTiposIdentificacion").ForeignKeyValue("Nombre").DataSource((List<TipoIdViewModel>)PersonaServices.GetTiposId()).Add();
    col.Field("NumeroId").HeaderText("Numero id").Add();
    col.Field("PrimerNombre").HeaderText("Primer nombre").Visible(false).Add();
    col.Field("SegundoNombre").HeaderText("Segundo nombre").Visible(false).Add();
    col.Field("PrimerApellido").HeaderText("Primer apellido").Visible(false).Add();
    col.Field("SegundoApellido").HeaderText("Segundo apellido").Visible(false).Add();
    col.Field("NombreCompleto").HeaderText("Nombre").Add();
    col.Field("TelefonoMovil").HeaderText("Celular").Add();
    col.Field("Email").HeaderText("Email").Add();
    col.Field("IdSede").HeaderText("Sede").ForeignKeyField("IdSede").ForeignKeyValue("Nombre").DataSource((List<SedeViewModel>)ContratoServices.GetSedes().FindAll(s => s.Habilitado)).Add();
    col.Field("WelcomeDay").HeaderText("Welcome day").EditType("datetimepickeredit").Add();
    col.Field("Observaciones").HeaderText("Obs").Add();
    col.HeaderText("Enviar email").Width("160").Commands(comandos).Add();
    col.Field("IdContrato").Visible(false).Add();
}).Locale("es-CO").Load("load").EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog); }).Toolbar(toolbarItems).Render()

script:
    function load(args) {
        this.columns[13].commands[0].buttonOption.click = function (args) {
            debugger;
            var x = correo;
            var gridObj = ej.base.getComponent(document.getElementById("grdBeneficiarios"), ej.grids.Grid);
            ??? how to get the row or better, the cell value in "Email" column ?
           
        };

Thanks for your help.
Kind regards,
Juan J.


1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team March 20, 2019 01:59 AM

Hi Juan, 

Greetings from Syncfusion. 

Based on your we suspect that you want to the cell values while we click on the command button. 

We have already discuss about the above mention query in the following documentation. 


Please let us know if you need further assistance on this. 

Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon