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

Batch Edit Mode Error: Conditional compilation is turned off

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 23 Oct 2013, 03:46 AM
Hi Team Telerik,

Is batch editing mode compatible with a hierarchical grid? Here's why I ask:

So I was implementing Batch Edit mode throughout my application. It works fine on a single layer grid. However, when I try to apply it to a hierarchical grid, I run into problems.

First, I have a hierarchical grid with HierarchyLoadMode="Client". When I try to do any the batch CRUD operations, I get this viewstate error on the TOP level:

0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

So I set ViewStateMode="Disabled" on the Grid itself and that error goes away when I do CRUD operations on the top level. However, when I try to do CRUD operations on the second level, I get another error:

JavaScript critical error in (unknown source location)

SCRIPT1030: Conditional compilation is turned off

I've tried a couple of things to correct this error:

  1. I tried disabling the ViewStateMode on that GridTableView. Error still occurs.
  2. I tried removing HierarchyLoadMode="Client". It fixed the first error, but this "Conditional compilation is turned off" error still recurs.

My hierarchical grids are being powered by a SQLDataSource object.

I noticed that no one else complained about the error anywhere in the Grid forum, but I did find complaints about the error in the Telerik Reports forum and that was rectified with a version update. From that thread, I've inferred that the error seems to be related to jQuery somewhere inside the Telerik dll. I'm using Telerik AJAX version 2013.2.717.45

Is this a known issue?

Thanks in advance.
Jonathan

1 Answer, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 1
answered on 23 Oct 2013, 06:00 AM
Hi again,

Problem solved.

The problem was actually in my RadGrid_BatchEditCommand subroutine. I didn't realize that the Hash Table with NewValues doesn't also automatically contain any foreign key values for records to be inserted. So I was making a reference to:

e.Commands(i).NewValues("ForeignKey")

...where "ForeignKey" was not in the hash table at all. So once I tried to run the query to perform an insert, somehow, it bubbled up an error that caused that "Conditional compilation is turned off" error (which isn't a very helpful error at all). To reference the foreign key from one layer up in the hierarchy, I simply did:

e.Item.OwnerTableView.ParentItem.GetDataKeyValue("Criterion").ToString()

...and that fixed the last error. I think I'm good to go.

Cheers,
Jonathan
Tags
Grid
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
Share this question
or