Telerik MVC grid - how to set the selected row by default

Is it possible to display a Grid with one row selected by default (set the right page number and select a row)?

+3
source share
3 answers

For highlighting, try using the "OnRowDataBound" event

.ClientEvents(events => events.OnRowDataBound("onRowDataBound"))

with something like

function onRowDataBound(e) {
    var myId = $('#MyId').val();

    if (e.dataItem.Id == myId)
        e.row.className = 't-state-selected';
}

I'm still trying to figure out how to set the correct starting page number. This guy might be for something.

+3
source

Use the Grid RowAction method, for example:

.RowAction(row => row.Selected = row.DataItem.CustomerCode.Equals(ViewBag.ID))
+1
source

, , , , , , , , .

0

Source: https://habr.com/ru/post/1792215/


All Articles