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

Will commands work for creating a more explicit edit mode?

8 Answers 133 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Daniel Billingsley
Top achievements
Rank 1
Daniel Billingsley asked on 24 Jun 2010, 02:39 PM
I really think the default way the grid works is not very intuitive for users.  For example, when you are editing a cell and press return, it drops down to the next cell and begins edit mode.  That leaves the user thinking "how do I get out of edit mode".

I'd like to create a more explicit situation, where the user clicks a button in the row to enter edit mode, and then can't exit that row until they press an Apply or Cancel button (which is also in the row).  I'm hoping to get close to that anyway.

In my grid I have a final column of buttons.  I've tried using a CellTemplate and CellEditTemplate to switch the buttons when the row is being edited, but it seems the CellEditTemplate is only used when that particular cell is selected.  Is that right?

------

Also, I've looked at the commands demo thinking that might help out, and it seems there's something missing in the supplied xaml or code-behind.

In the code-behind shown, what is the point of declaring those ICommand objects?  Where are they used?

In the running sample the Save and Cancel buttons are only enabled when you enter edit mode, but I don't see anything in xaml or code to cause that.  When I put a similar button on my form it is always enabled.

Is it possible to have a Save button using those commands actually in each row?

8 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 30 Jun 2010, 04:14 PM
Hi Daniel Billingsley,

Sorry for the late reply.

This behavior of the Enter key is extremely useful if you have to edit a great amount of data. However you can override any key behavior with a few lines of code. I'm attaching a sample application that demonstrates this approach (take a look at CustomCommandProvider class and its usage).

Indeed commands example is all you need. I'm attaching a sample application how you can add save button to your row.

Q: "In the code-behind shown, what is the point of declaring those ICommand objects?  Where are they used?"
A: This is a known limitation of our commands implementation. RadGridView commands will be registered by the static constructor of the RadGridView. Therefore there are 2 options:

1. Like in example just get all RadGridView commands which you will use before InitializeComponent() call.
2. Another option is to use these commands after RadGridView declaration (xaml parser will call static constructor) (demonstrated with the attached example).

Let me know if this doesn't help.

Greetings,
Nedyalko Nikolov
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
0
Daniel Billingsley
Top achievements
Rank 1
answered on 30 Jun 2010, 06:09 PM
That's very helpful for seeing how to use the commands, but it's not exactly what I'm looking for.

Consider a user who is not very technical.  I've modified your example slightly to include a cancel button in each row next to the save button you had. 

But when the page first loads there's no clues when looking at the grid that you can double-click in a cell to begin editing it.  I'd like to have an edit button next to, or instead of, the delete button on each row.  And I probably want to disable the editing by double click in a cell. 

Are those two things possible?  So there's an obvious Edit button on each row, and that's the only way to begin editing a row, and the only way out of that row once you start editing is to press the Save or Cancel?
0
Nedyalko Nikolov
Telerik team
answered on 01 Jul 2010, 03:18 PM
Hello Daniel Billingsley,

You can stop users from entering edit mode with RadGridView.EditTriggers property.
For other tasks you could easily achieve this by a few lines of code using RadGridView UI validation mechanism.
I'm attaching a modified version of the sample application that I think covers your scenario.
Let me know if this doesn't help.

Sincerely yours,
Nedyalko Nikolov
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
0
Daniel Billingsley
Top achievements
Rank 1
answered on 06 Jul 2010, 09:31 PM
Yeah, that's close to what I'm looking for... except...um... it doesn't work.

The Save and Cancel buttons never become visible.

Does it work for you?

I'm not real crazy about using the validation to block exiting the row, as the red exclamation implies there's an error when there isn't really, but I may be able to live with that.
0
Nedyalko Nikolov
Telerik team
answered on 08 Jul 2010, 10:03 AM
Hi Daniel Billingsley,

You can take a look at this video and check how this works on my end.
Could you try to reproduce the issue with the project attached? Thank you in advance.

Kind regards,
Nedyalko Nikolov
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
0
Daniel Billingsley
Top achievements
Rank 1
answered on 12 Jul 2010, 02:32 PM
OK, I downloaded your attached sample again.  I can't get it to compile/run because it says it can't find the type or namespace RadGridView.  I remember from the first time I tried it that I eventually had to remove all your references and add back in references to my installed Telerik controls.

Is there a security issue that's stopping the compiler from seeing the dll's included in the zip file you attached?  Should it still work references my local assemblies?

0
Nedyalko Nikolov
Telerik team
answered on 13 Jul 2010, 02:19 PM
Hello Daniel Billingsley,

The only security that could be related is "Windows block files problem". You could try to download latest internal build from your client account. The example should work with these assemblies.

Kind regards,
Nedyalko Nikolov
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
0
Daniel Billingsley
Top achievements
Rank 1
answered on 13 Jul 2010, 03:53 PM
OK.  I was able to get it to work after unblocking those assemblies.  There must have been a change to the grid since the Q1 version I'm using.
Tags
GridView
Asked by
Daniel Billingsley
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Daniel Billingsley
Top achievements
Rank 1
Share this question
or