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

Can't trigger OnUpdateCommand event when EnableViewState is false

3 Answers 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dino
Top achievements
Rank 1
Dino asked on 31 Mar 2010, 02:38 PM
Hi there,

Having spent several hours trying to work this out, I thought I'd just post it hear in case anyone else has any similar issues.

I found this great article here, which implied I could implement my idea:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/manual-insert-update-delete-using-formtemplate-and-sql-backend.aspx


However, having set a handler for the OnUpdateCommand event (let's say RadGrid1_UpdateCommand), the flow would never enter into the handler when I clicked the Update button on my FormTemplate. As soon as I allowed EnableViewState again, it started working again - albeit with another caveat...

It seems that, even though I only wanted to allow EDIT on this particular RadGrid (ie NO Delete and NO Insert), I still had to enter stub handlers (ie DataGrid1_InsertCommand and DataGrid1_DeleteCommand) and declare them against the right events (ie OnInsertCommand and OnDeleteCommand).

I really wish this stuff was better documented! I nearly gave up on getting this to work. Not everyone uses DataSources, and the documentation is abysmal for people using decent Business Logic & Data Access Layers.

Thankfully, it's all working nicely now, but some better documentation would have helped in getting this sorted less painfully...

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 06 Apr 2010, 08:46 AM
Hello Dino,

I am afraid that custom editor forms with EnableViewState property is set to false is not supported scenario. You can find it documented on the link bellow:
http://www.telerik.com/help/aspnet-ajax/grdviewstateoptimization.html

Best wishes,
Nikolay
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
Dino
Top achievements
Rank 1
answered on 06 Apr 2010, 12:49 PM
Hi Nikolay,

Thanks for clarifying that. You're right, that article you linked to does indeed mention that this won't work for Custom Forms, but I'll be honest - I tend not to refer to the online documentation because in a lot of cases:

1) It doesn't show decent example code
2) It assumes that we're using DataSources, rather than an N-tier style dataaccess layer, etc

For example, on that same page you mentioned, there is the following text:
[quote]
Some operations in Telerik RadGrid like data extraction through the ExtractValuesFromItem method
[/quote]

Couldn't that link to a page showing an example of how to use that method?? Or more info on that method?

This is why I still tend to use some old PDF documents that I found a while ago - from Q2 2008.

Anyway, thanks for clarifying this!
0
Nikolay Rusev
Telerik team
answered on 09 Apr 2010, 11:41 AM
Hello Dino,

ExtractValuesFromItem is one of the ways to extract all values for given item. In general you can use on Insert/Update commands when implementing manual operations with RadGrid.
Sample code can be found on the demo bellow (UpdateCommand/InsertCommand handlers):
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/extractvalues/defaultcs.aspx

Documentation article that illustrates two ways of extracting values from item one of which is with using ExtractValuesFromItem:
http://www.telerik.com/help/aspnet-ajax/grdupdatinginplaceandeditforms.html

Other way of manual CRUD operations:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/programaticlinqupdates/defaultcs.aspx

Best wishes,
Nikolay
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
Dino
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Dino
Top achievements
Rank 1
Share this question
or