How to use Format: Webgrid?

5

I'm developing with MVC, and I have the view list

[...]

var columns = new WebGridColumn[] {
        grid.Column("Id"),
        grid.Column("Descricao"),
        grid.Column("UsuarioModificacao"),
        grid.Column("DataModificacao"),
        grid.Column("UltimoLogAcesso.DataAcesso"),
        grid.Column("UltimoLogAcesso.Ip"),
        grid.Column("UrlChamadaAlerta", format: (grid) => string.Format("{Id}")),
        grid.Column("FlagBloqueioPainel"),
        grid.ButtonColumn("ico_permission.gif", x => Url.Action("ConfirmarExclusao", "PainelChamada", new { id = x.Id } ), updateTargetId: "console"),

I need to format the UrlCamadaAlerta column that should be in this format

painel.ejis.com.br/?id=<PainelChamada.ID>&token=<PainelChamada.GuidPainelChamada > 

I'm going to use the ID and the Guid that are in the PaintedCalc model

        public int Id {get; set;}
        public System.Guid Guid { get; set; }

Personal, the right would be to create routes, but for now the format will meet my purpose. Note: how will be used the format certain properties that would be made with the routes do not have to be perfect. My Format is wrong, but my difficulty is to mount the correct expression.

grid.Column("UrlChamadaAlerta",
            format: dataItem =>
                    string.Format("painel.ejis.com.br?id={0}&token={1}",
                                  dataItem.Id,
                                  dataItem.Guid),

It's the tip that you need!

    
asked by anonymous 30.12.2014 / 13:17

1 answer

0
grid.Column("UrlChamadaAlerta",
            format: dataItem =>
                    string.Format("painel.ejis.com.br?id={0}&token={1}",
                                  dataItem.Id,
                                  dataItem.Guid),

It's the tip that you need!

    
30.12.2014 / 20:44