This is a migrated thread and some comments may be shown as answers.

[Solved] Select first row

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bruno
Top achievements
Rank 1
Bruno asked on 20 Jul 2011, 09:30 AM
How can I select the first row in my grid on load? I use Ajax Binding.

Thanks for the help
Bruno

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 20 Jul 2011, 12:28 PM
Hi Bruno,

 You may use the dataBound event to add selected class to grid's first item:

<script type="text/javascript">
    var selected = false;
    function dataBound() {
        var rows = $($(this).data("tGrid").$rows());
        if (!selected) {
            selected = true;
            rows.first().addClass("t-state-selected");
        }
    }
</script>

Regards,
Rosen
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Bruno
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or