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

Client side in-place add/edit/delete

4 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott R
Top achievements
Rank 1
Scott R asked on 14 Sep 2010, 11:01 PM
We use client-side data binding extensively for our "read only" grids and it works great. However, I now have a scenario where I would like to use the RadGrid to edit data.

Is there a way to bind the data on the client side and then put all rows into "edit" mode? I tried the "editAllItems" method on the master tableview but it doesn't actually put the rows into edit mode, it just does a postback telling the grid to do the work on the server.

I want to be able to add, edit (in place) and delete rows on the client without ever generating a postback. All rows should *always* be in edit mode. Is it possible?

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 17 Sep 2010, 06:05 AM
Hello Scott,

You cannot use built-in forms for editing when using client-side binding. However the following demo illustrates one possible way to achieve this functionality:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/insertupdatedelete/defaultcs.aspx

All the best,
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
Scott R
Top achievements
Rank 1
answered on 17 Sep 2010, 03:08 PM
Hi Nikolay,

Thanks for the suggestion. I had seen that demo earlier but it is not the functionality I am trying to achieve.

What I have ended up doing instead is using a standard Repeater to build an HTML table with 50 rows in it. I hide all of the "unused" rows at the bottom using CSS styles. I then "unhide" a row when the user clicks the "add row" button. This works, but it is unfortunate that I have to send 50 rows of HTML (including all of the controls contained in those rows) from the server to the client browser even though the user will probably never need more than 10 or so.

I tried just creating new table rows as needed using javascript (which is not a problem), but I couldn't figure out how to create/clone the RadControls on the client using javascript (I need a combobox, input, and numeric input in each row). So I am stuck sending a fixed number of rows from the server and just hiding/showing rows as necessary.

If anyone has any ideas for how to accomplish this a better way I would love to hear from you.

Scott
0
Nikolay Rusev
Telerik team
answered on 23 Sep 2010, 09:04 AM
Hello Scott,

I am afraid that it is very hard to create any IScriptControl( as  RadControls for ASP.NET AJAX) on client  due to complex rendering and script required for this controls to function properly. Thus the example demonstrates how to overcome this and have external edit/insert forms.

Greetings,
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
Scott R
Top achievements
Rank 1
answered on 23 Sep 2010, 03:48 PM
Thanks Nikolay.

I ended up adding/removing rows from a normal HTML table instead. I created regular HTML controls using Javascript then added them to a RadInputManager (also using javascript). It is an acceptable work-around for my case.

Here is a link to another thread with some code samples in case someone is interested:
http://www.telerik.com/community/forums/aspnet-ajax/input/a-javascript-q.aspx

Scott
Tags
Grid
Asked by
Scott R
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Scott R
Top achievements
Rank 1
Share this question
or