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

JavaScript runtime error when updating radgrid source

3 Answers 49 Views
Documentation and Tutorials
This is a migrated thread and some comments may be shown as answers.
Casper
Top achievements
Rank 1
Casper asked on 08 Apr 2015, 09:26 AM

 

I have a radgrid that inherits it hierarchy from a System.Data.DataSet. When I make a change I update the database from which the DataSet gets its data and rebuild the grid as this answer suggests. The first time the update always runs as expected and updates in the grid. After that after varying amount of changes( I can't seem to figure out exactly which one causes this) I get the following error:

JavaScript runtime error: Unable to get property 'get_element' of undefined or null reference

 

I hope you are able to help

 

/Casper

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 13 Apr 2015, 06:56 AM
Hello Casper,

Can you please verify that you are not using DataBind() to bind the grid? Please note that performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
Declarative DataSource
Advanced Data Binding


Here is a live demonstration for declarative binding of a hierarchy:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/insert-update-delete-hierarchy/defaultcs.aspx
And also programmatic:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/programmatic-hierarchy/defaultcs.aspx


You can also check the following sample for CRUD operations:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/insert-update-delete-hierarchy/defaultcs.aspx

Hope this helps.

Regards,
Eyup
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Casper
Top achievements
Rank 1
answered on 13 Apr 2015, 08:27 AM

I am setting the radgrid's datasource to my dataset. I wasn't using the DataBind()-function, but I tried inserting it after the datasource assignment and suddenly couldn't get to a hierarchy level above 2 even though i could before(and can if it is removed).

I've seen the links you've provided. I'm not sure if I can use them in the same way. I initially thought this was a generic problem, but it might be specific to my case. I have a rather large set of tasks. each task can have a subtask and each subtask can have another subtask(this extends to an arbitrary large depth). The way this hierarchy currently is implemented is that each task have a column containing their parent id, and the root of the hierarchy have null as a parent.
The current implementation, that gives the first mentioned error, is that I programatically create the dataset and the relations between the tables and then rebuild the entire grid. On an update I manually update my database with the the new values and build it again.
As mentioned earlier the application throws an exception if it is updated more than 1 time, what i find curious is that when the application is restarted the grid is updated and no new exception is thrown until 2 or more alterations have been made

0
Eyup
Telerik team
answered on 16 Apr 2015, 06:07 AM
Hi Casper,

This might be something related to the ViewState then. If you are changing the columns structure dynamically, you should do that according to the steps provided in the following article:
http://www.telerik.com/help/aspnet-ajax/grid-changing-structure-dynamically.html

Regards,
Eyup
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Documentation and Tutorials
Asked by
Casper
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Casper
Top achievements
Rank 1
Share this question
or