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 4511 posts 10090 karma points MVP 2x admin c-trib
    Aug 10, 2015 @ 15:18
    Ismail Mayat
    0

    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

    row["clickEventJs"]!=null
    

    Same error.

    Any ideas?

    Regards

    Ismail

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Aug 10, 2015 @ 15:57
    Warren Buckley
    0

    Ismail
    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:

Draft