1
votes

At the time of populating the table, is it possible to refer to a column in a previous row?

So something like this: Refer to an other columns value in a MVC3 Razor WebGrid Except I want to refer to the same column but from a previous role.

For example, this is the column I'd like to know all values for:

//check if statement before creating it
foreach(Column("Prop") c in allRowsCollection) {

    if(c.Value = "something") { //check if there is already a row with a specific value for this column
          grid.Column("Prop", "example1"),    
    } 

    else {
          grid.Column("Prop", "example2"),
    }
}

So every time I add a new row, I'd like to compare it with the previous one.

Is this possible? If not, is there some workaround?

1

1 Answers

0
votes

If you bind to against a datasource you can check the datasource and not the grid.

I would however sort this out during my sql call and omit any front end checking.

Chances are it'll be faster too because you're not moving as much data over the wire.