Multiple edit grid inline

4 posts, 0 answers
  1. James
    James avatar
    13 posts
    Member since:
    Sep 2008

    Posted 20 Dec 2010 Link to this post


    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.

  2. Johnathan
    Johnathan avatar
    23 posts
    Member since:
    Jul 2010

    Posted 20 Dec 2010 Link to this post

    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.
  3. James
    James avatar
    13 posts
    Member since:
    Sep 2008

    Posted 21 Dec 2010 Link to this post

    Thanks Johnathan,

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


  4. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 22 Dec 2010 Link to this post

    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.

    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.
Back to Top