asp.net-mvcdevexpressdevexpress-mvcdevexpress-gridcontrol

Focused Row by value DevExpress ASP.NET MVC Grid View


I need to have a focus on the Grid View but I would like to get it by value, for example if I have a Names column and I want to get the row for the name 'Walter' I would like to get the focus for that row.

In this case, this is done by key of the row, but I need it by value.

var sender = (MVCxGridView)s;
        // Set the zero-based index of the focused row.
        sender.FocusedRowIndex = 6;


Solution

  • As i know you cannot focus with value in a gridview. When I need to do this scenario I do it this way,follow the steps bellow using asp.net:

    1. For i=0 to gridview.RowCount-1
    
       2.If gridview.getrowcellvalue(i,gridview.columns("Name")
    
             3. gridview.FocusedRowHandle=i
          End If
    
      Next