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

[Solved] Which cell did I click

1 Answer 84 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.
Gerard Eikelboom
Top achievements
Rank 1
Gerard Eikelboom asked on 27 Aug 2010, 08:10 AM
Hello,
I have a question about the cell click in the grid.

What I like to know is:
How to know wich cell I clicked.
So when I click the fist cell I like to know it's value when I click the second cell then I want to know that value.

Why?

I only want something to happen when I click a specific cell in the grid So Only when I click in eg cell[1] then an action is the result.
It doesn't matter what row I am.

Thanks in advance,
Gerard Eikelboom
.NET Developer @Fleura
www.Fleura.com

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Aug 2010, 01:11 PM
Hi Gerard Eikelboom,

You can use jquery and add a click handler to your grid like this:

<%= Html.Telerik().Grid()
        .Name("#Grid")
        .ClientEvents(events => events.OnLoad("onLoad"))
%>

<script type="text/javascript">
    function onLoad(e) {
        $('td', this).live('click', function(e) {
        var cell = this;
        alert(cell.cellIndex);
    });
}
</script>

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Gerard Eikelboom
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or