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

Going into edit mode on double click

2 Answers 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 28 Jan 2009, 09:54 PM
Hi,
There seems to be some confusion/complication about adding this behaviour. I have found several pages withc with differing suggestions.

http://www.telerik.com/help/aspnet/grid/grdgoingintoeditmodewithajaxdoubleclick.html
http://www.telerik.com/help/aspnet-ajax/grdgoingintoeditmodewithajaxdoubleclick.html
http://demos.telerik.com/aspnet/Grid/Examples/AJAX/EditOnDblClick/DefaultCS.aspx
http://www.telerik.com/community/code-library/aspnet-ajax/grid/edit-on-double-click-in-hierarchical-grid.aspx

It does seem that at least one variation is to do with which collection of controls is being used (with or without AJAX). However when I undertook a search for "double click" not all of these were returned (and certainly not the last one which is probably the most useful).

Would there be a case for cleaning up the documentation?

Also would it not make more sense to add such functionality (and in fact much else of the fixes and suggestions) as an optionional setting within the controls (in a future version)? I ask this because it worries me that I am adding an awful lot of "code behind" and javascript to my application, which will undoubtedly "break" when future versions are released and APIs and such change.

PROBLEM: I actually have a question/problem. The functionality is great, but seems not quite right! Specifically:

1) Double Click a row and the row switches to Edit Mode, great.
2) Single Click a different row and nothing happens.
3) Instead of 2, douible click a different row and the first row is no longer in edit mode, second one is (unless AllowMultiRowEdit is true, in which case they both are).
4) Modify a field on the row (being edited) and single click another, up pops the question about saving changes.
5) Answer NO and now it unravels a bit. The edited row remains in edit mode with the changes, but now further clicks outside it do not prompt for changes, nor turn off edit mode.
6) having changed a field value, then click on the Update button. The data is saved adn the row returns to non-edit mode, but clicking on another row still produces the Prompt about saving changes.

I was looking into modifying the code myself, but have run into the problem that I can't find the Client Side method to turn off edit mode? I also need to be able to clear the hasChanges variable when the user performs an update through the normal button/link/image click.





2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 02 Feb 2009, 05:10 PM
Hello Andrew,

 We do not consider to clear up parts of our documentation because we still support Classic RadControls as well as RadControls for ASP.NET AJAX. But as you noticed, there is difference and it is pointed in our documentation. I hope this answer to your question.

Thank you for your suggestion about integrated edit-on-double-click functionality - I will forward it to our developers to be considered further and updated your Telerik points for the feedback.

To turn off edit mode of the grid on client-side, you just need to execute its cancelAll() method.

Here is a code snippet showing how to achieve this:
  $find("<%= RadGrid1.MasterTableView.ClientID %>").cancelAll(); 

You can set to false the HasChanges variable anywhere on the client-side. In other words, you can attach a JS method which will erase the value of the HasChanges variable before performing postback request. Inside the OnItemCreated server handler you can find the row for which you want to clear HasChanged variable.

The code below shows how to distinguish whether the item is in edit mode:
protected void RadGrid1_ItemCreated(object  sender, Telerik.Web.UI.GridItemEventArgs e) 
   { 
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
       { 
 
.... 

Kind regards,
Georgi Krustev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Andrew
Top achievements
Rank 1
answered on 02 Feb 2009, 09:50 PM
Hi Georgi,

Many thanks for the reply, I think that is enough for me to make the changes I need.

Andrew
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or