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

Multiple edit grid inline

3 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 20 Dec 2010, 08:00 PM
Hi,

I have a multiple row grid, where I want its initial state to be all inline editable.  The user can then immediately start entering the details into the fields.

When the user saves the grid, all fields are saved, and any field that has been provided with valid data, becomes a plain text link (which will link to something else on click) - IE its no longer an editable field but a plain text link.

Therefore I start with a fully inline editable grid, which becomes a mixture of inline editable and plain text fields, depending on what has been entered.

Could you advise how this could be acomplished with telerik grids as I can't see anything like this in a demo.

Thanks

3 Answers, 1 is accepted

Sort by
0
Johnathan
Top achievements
Rank 1
answered on 20 Dec 2010, 11:18 PM
I'm not sure how Telerik will advise you to do this, but I would do it in these steps:

1.) Every column that you want to have editable fields should be a GridTemplateColumn.  In that template you can have an asp:TextBox or a telerik:RadTextBox, or any other control that is appropriate, like a checkbox or dropdown control.
2.) Create a datasource collection (List<T>) that contains the number of records for every row you want to have pre-set to enter.  Probably loaded from the database and then followed by inserting records that have not been entered by the user.  Set the RadGrid.DataSource to this collection.
3.) Add an ItemDataBound event to the RadGrid and post-process your rows.  Possibly in step 1 you can have two types of fields in each column.  A TextBox and a link.  In the ItemDataBound event, you compare your datasource and make the appropriate control visible or invisible depending on whether there is data or not.  The other option would be to put a function in each template to make the field visible like:

 Visible="<%# ShouldDisplay(((My.ObjectType)Container.DataItem).FieldName)%>"
 
 
Then in  your code-behind return a true or false.  There should be examples of building template columns in Telerik's archives.
0
James
Top achievements
Rank 1
answered on 21 Dec 2010, 08:28 AM
Thanks Johnathan,

Thats very helpful. Could someone from Telerik confirm that this is the most simple/logical method of accomplishing this task.

Thanks

James
0
Iana Tsolova
Telerik team
answered on 22 Dec 2010, 03:05 PM
Hello James,

You can use the provided solution or:
Put all grid items on initial load as described here. Then perform batch update and leave the grid in read-only mode.

Regards,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
James
Top achievements
Rank 1
Answers by
Johnathan
Top achievements
Rank 1
James
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or