I have a Dynamic Data project and have edited the Global.asax.cs file to allowing combined page mode:
// The following statements support combined-page mode, where the List, Detail, Insert, and
// Update tasks are performed by using the same page. To enable this mode, uncomment the
// following routes and comment out the route definition in the separate-page mode section above.
routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")
{
Action = PageAction.List,
ViewName = "ListDetails",
Model = DefaultModel
});
routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")
{
Action = PageAction.Details,
ViewName = "ListDetails",
Model = DefaultModel
});
After pressing Edit in a ListDetails page to edit a GridView row, you can edit the fields in the row and press Update to commit the changes. However if during typing you press the Enter key on the keyboard, the changes to the row are cancelled.
Does anyone know of anyway to change this behaviour to submit the changes, rather than cancelling (or at least prevent the cancel)?
I've search around and found people have used javascript on the client side to trap the enter key, e.g. in a GridView RowEditing event:
Sorry for the delay in responding. I was diverted onto something else for a while.
I tried the UpdateableList page template you kindly sent me and while I do prefer the way you insert records (inline in the grid), I had a couple of problems, that means I will need to go back to using ListDetails for the time being until I have time to
look again at this:
1. I'm using DomainService and while I could edit the code you sent to work with DomainService I get Domain Exceptions when editing records which relate to entity that have restricted access for the user.
2. The UpdateableList page template doesn't really solve the problem I created this thread for. It is improved in that when you press enter while editing an inline field, it doesn't cancel the entire row edit operation (which happens when I use the ListDetails
page template), it does clear the field being edited.
Sorry Biga, at the moment UpdatableList does not work with Domain Service dues to some issues with DomainService data source, I think I have a way around it but I am trying to find out if there is any future in Domain Service as I can't see a project templte
for eith DS or Linq to SQL in VS2012.
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
yes it woudl but there are new things comming in 4.5 such as model binding which may make this not a problem, and I don't think DS will go a way soon I just don't see any more development inverment.
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
Member
51 Points
53 Posts
GridView inline Editing (ListDetails.aspx) - pressing Enter key cancels the edit
Jun 25, 2012 07:32 AM|biga|LINK
I have a Dynamic Data project and have edited the Global.asax.cs file to allowing combined page mode:
After pressing Edit in a ListDetails page to edit a GridView row, you can edit the fields in the row and press Update to commit the changes. However if during typing you press the Enter key on the keyboard, the changes to the row are cancelled.
Does anyone know of anyway to change this behaviour to submit the changes, rather than cancelling (or at least prevent the cancel)?
I've search around and found people have used javascript on the client side to trap the enter key, e.g. in a GridView RowEditing event:
However this doesn't work
All-Star
17916 Points
5681 Posts
MVP
Re: GridView inline Editing (ListDetails.aspx) - pressing Enter key cancels the edit
Jun 25, 2012 09:31 AM|sjnaughton|LINK
Hi Biga, I do have a custom page template that allows inline Edit and Insert send me an e-mail and I will send you a sample :)
Always seeking an elegant solution.
All-Star
94130 Points
18109 Posts
Re: GridView inline Editing (ListDetails.aspx) - pressing Enter key cancels the edit
Jun 30, 2012 09:43 PM|Decker Dong - MSFT|LINK
How's everything going with you?Anyfeedback is welcomed……
Member
51 Points
53 Posts
Re: GridView inline Editing (ListDetails.aspx) - pressing Enter key cancels the edit
Jul 04, 2012 11:28 AM|biga|LINK
Hi Steve,
Sorry for the delay in responding. I was diverted onto something else for a while.
I tried the UpdateableList page template you kindly sent me and while I do prefer the way you insert records (inline in the grid), I had a couple of problems, that means I will need to go back to using ListDetails for the time being until I have time to look again at this:
1. I'm using DomainService and while I could edit the code you sent to work with DomainService I get Domain Exceptions when editing records which relate to entity that have restricted access for the user.
2. The UpdateableList page template doesn't really solve the problem I created this thread for. It is improved in that when you press enter while editing an inline field, it doesn't cancel the entire row edit operation (which happens when I use the ListDetails page template), it does clear the field being edited.
Thanks again for all your help.
All-Star
17916 Points
5681 Posts
MVP
Re: GridView inline Editing (ListDetails.aspx) - pressing Enter key cancels the edit
Jul 06, 2012 06:09 AM|sjnaughton|LINK
Sorry Biga, at the moment UpdatableList does not work with Domain Service dues to some issues with DomainService data source, I think I have a way around it but I am trying to find out if there is any future in Domain Service as I can't see a project templte for eith DS or Linq to SQL in VS2012.
Always seeking an elegant solution.
Member
51 Points
53 Posts
Re: GridView inline Editing (ListDetails.aspx) - pressing Enter key cancels the edit
Jul 06, 2012 03:35 PM|biga|LINK
All-Star
17916 Points
5681 Posts
MVP
Re: GridView inline Editing (ListDetails.aspx) - pressing Enter key cancels the edit
Jul 09, 2012 04:14 AM|sjnaughton|LINK
yes it woudl but there are new things comming in 4.5 such as model binding which may make this not a problem, and I don't think DS will go a way soon I just don't see any more development inverment.
Always seeking an elegant solution.