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

Edit mode for detailtable

3 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 07 Aug 2009, 05:13 PM

I have a grid that contains one detail table. I am binding both the master and detail table in code. I am trying to get inplace editing to work for the detail table and am having some problems. When i click my edit button, i handle the itemcommand event and proceed to put the grid item (e.item) into edit mode (e.item.edit=true). I then rebind the grid, except that i never get into the edititem for the itemdatabound event for hte detail table. I am using this method for the master table and it works great for that. Is there a trick for putting a row into edit mode in a detail table?

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Aug 2009, 05:38 AM
Hi,

For RadGrid if you are using an auto-generated Edit column or a GridEditCommandColumn, you do not have to use any code behind approach to set the item in edit mode. If you are using a GridButtonColumn you just need to set the CommandName property to Edit for achieving the editing functionality. If this does not help I would suggest you to send your aspx code.
Update/Insert/Delete in Hierarchy

Thanks
Shinu

0
Dave
Top achievements
Rank 1
answered on 10 Sep 2009, 01:23 PM
I have a templatecolumn that contains an imagebutton in its itemtemplate. When the button is clicked, I handle the itemcommand event of the grid. I then look for the commandname of the imagebutton. Again, this was a button of a row of the detail table, so when i handle the commandname, i put the row into edit mode (e.item.edit=true) and then call grid.rebind(). As i described above, i never hit the edititem case for the itemdatabound for my detail row. And when the page comes back, the master row is expanded but detail table is gone. 

Is there a way to put a detailtable row into edit mode from code, specifically from the ItemCommand?
0
Princy
Top achievements
Rank 2
answered on 11 Sep 2009, 07:24 AM
Hello,

You can try out the following code to set the detailtable row in EditMode:
c#:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == "CustomCommand"
        { 
            e.Item.Edit = true
            e.Item.OwnerTableView.Rebind(); 
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Dave
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Dave
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or