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

[Solved] Double-Click Row Issue

1 Answer 108 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 13 Sep 2010, 08:47 PM
I have a requirement that the user would double-click a row (actually a specific cell) and I would increase an integer field by one.  I have the code that accomplished this on a single click but I am running into two issues.

1. if the user double clicks, the field is opened for editing and clicking no longer causes the event (selection changed event).  I was thinking of intercepting the editing event and increasing the quantity but that doesn't seem right.

2. I tried to set the cell to read-only but that didn't work either.

What is the best way to capture a single or double click and update a particular cell in that particular row?

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 14 Sep 2010, 01:02 PM
Hi Michael,

You can listen for cell double click in the following way:

public MainPage()
{
    InitializeComponent();
  
    this.playersGrid.AddHandler(GridViewCellBase.CellDoubleClickEvent, 
        new EventHandler<RadRoutedEventArgs>(OnCellDoubleClick), true);
}
  
private void OnCellDoubleClick(object sender, RadRoutedEventArgs args)
{
    GridViewCellBase cell = args.OriginalSource as GridViewCellBase;
    if (cell != null)
    {
          
    }
}

Once this is done the only thing left to do is to deal with the grid entering edit mode when you click on cells. You could either disable the editing functionality globally by setting IsReadOnly of the grid to false or set IsReadOnly to true on specific columns only.

Hope this helps.


Regards,
Milan
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
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or