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

[Solved] RadGrid to be used as Input

3 Answers 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saurabh Srivastava
Top achievements
Rank 1
Saurabh Srivastava asked on 10 Aug 2009, 01:08 PM
Hi,

I am trying to use the RadGrid to accept inputs from the user. My requirement is as follows:

When the page loads, I load an empty grid with only the column names and the Add CommandItem - Done
On my page load, I also create an empty datatable which will hold all the request records.

When I click on Add, a new row should appear on the grid to accept inputs (along with the 'save' and 'cancel' buttons).

After saving the row, the row should appear in the grid with "edit" and "delete" columns.

3 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 10 Aug 2009, 02:00 PM
I'd say look at this demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx
Also, in regards to the datatable, I'd say just have a dummy entry as your first entry (which is what the initial open edit will display) which will just be replaced by the first user entry, this way you don't have to create a brand new table for each load.
0
Saurabh Srivastava
Top achievements
Rank 1
answered on 11 Aug 2009, 05:07 PM
Reposting it here on my thread. Apologies for duplicates as it just slipped my mind that I had created my thread for the issue

My situation is that I bind my grid to an empty object on PageLoad (within the !IsPostBack section). I also create a datatable which would be created at runtime as the user would fill in the grid. This datatable has been assigned to be the datasource of the grid in the NeedDataSource event.

Now as soon as I press on Add a new record, the NeedDataSource event is being fired and I get nothing displayed on the screen (i.e. the grid vanishes).

The issue here is that we need a simple sample which demonstrates a grid with template columns which loads empty by default, accepts the user input (into a datatabe) with Insert/Edit and Delete functionality.
 
Thanks,
Saurabh
0
Yavor
Telerik team
answered on 14 Aug 2009, 06:51 AM
Hello Saurabh,

To make sure that the control behaves as expected, you need to populate it with data in the NeedDataSource event handler. Setting its datasource anywhere else - for example in PageLoad, will break its default functionalities. Other than this, you can simply pass a datatable with as many rows as required, and with no data. All other logic is pretty standard - when the user has entered the data, you can intercept the command, and update the underlying datasouce as needed.
Let me know how this approach applies to your requirements.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Saurabh Srivastava
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Saurabh Srivastava
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or