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

Add new row to datasource via Ajax CallBack

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jwhitley
Top achievements
Rank 1
jwhitley asked on 13 Feb 2014, 12:58 AM
Hi,

I have a Grid which was previously not Ajaxified. The number of rows shown in the grid could change easily during a full post back.

We now want to show only 1 row, with further rows being added as the browser scrollbar reaches the bottom of the page. I have this working fine, but as the datasource is a System.Data.DataTable, the table is recreated during the callback (with one more row than before), and the Grid is then rebound.

It all works well... but the downside is that the complete Grid is re-rendered, rather than just a single row being inserted. This problem is amplified by the fact that each row is actually an iFrame which pulls its content from another page, so the total page vertical size jumps back and forth each time a new row is added, as the row height for each Grid row grows as its iFrame content is loaded.

What I want to achieve, from the viewers perspective, is the already loaded rows do not appear to be re-rendered... simply a new row was added and the page height grows once by the height of the newly added iFrame.

Can I achieve this with RadGrid? I will probably remove the iFrames and load the content into the Grid directly. They were added initially to speed up initial page load where the Grid contained many rows. Now that the rows are added one by one as the user scrolls, this page load time is no longer an issue. This would stop the page height bouncing all over the place, but will not stop the complete Grid being re-rendered each time a new row is added.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 17 Feb 2014, 03:40 PM
Hello John,

Thank you for contacting Telerik Support.

The behavior that you are observing is expected and is made that way by design. When you try to insert new record, the whole grid will be recreated again. The same applies for editing and deleting.

The only thing that I could suggest for your scenario is that you migrate to Batch Edit mode instead, where the editing, inserting and deleting is handled entirely on client-side, until the actual save to the database should occur (which is handled on server-side). You could have a look at our online demo for Batch Editing and to examine our documentation:

Please let me know if further assistance is needed on this matter.


Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
jwhitley
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or