Imagine being paid to improve your favorite CMS!

It could be you! Umbraco HQ are hiring and are looking for both talents and senior developers. Wonderful workplace, friendly colleagues and competitive salary.

Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Ismail Mayat 3978 posts 8074 karma points admin mvp c-trib
    Aug 10, 2015 @ 15:18
    Ismail Mayat

    Datatype grid null cell test

    How do i test if cell exists in datatype grid? I have

    if (row.GetCell("clickEventJs")!= null)

    Where row is GridRow

    However this gives key not found exception. I have also tried


    Same error.

    Any ideas?



  • Warren Buckley 2059 posts 4398 karma points admin mvp hq c-trib
    Aug 10, 2015 @ 15:57
    Warren Buckley

    I believe the row object has a list/collection of cell objects in it.

    With that being the case try a lambda expression to test if the current row has a cell with the alias of clickEventJs.

    This is totally off the top of my head

    @foreach(var row in Model.MyDataTypeGridAlias){
        //Check that our row has a cell with clickEventJs
        var clickJsCell = row.cells.SingleOrDefault(cell => cell.alias == "clickEventJs");
        if(clickJsCell !=null){
           //Do something with that value...
Please Sign in or register to post replies

Write your reply to: