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

Edit command is not fired

3 Answers 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
QualiWareUA
Top achievements
Rank 1
QualiWareUA asked on 24 Apr 2008, 12:11 PM
Hello,

I have an ASP.NET page that contains a RadGrid control. It has not auto generated columns and I use simple data binding, because advanced one does not work correctly for me. This RadGrid also has a CommandItemTemplate with, to make it simple, Edit button (performs in place editing of selected item). And the problem is when I click Edit button for selected row, it does not make the row editable. ItemCommand fires, but ItemIndex is not set and Item is null.

It seems to me that the problem is with data-binding. RadGrid's data source is set and bound on each page load. But I do not know how to overcome this. Any help will be highly appreciated.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Apr 2008, 12:16 PM
Hi,

Try the following code snippet to put the Grid in edit mode on clicking the edit button.

CS:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == "Edit") 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            item.Edit = true
        } 
    } 


Thanks
Shinu.
0
QualiWareUA
Top achievements
Rank 1
answered on 24 Apr 2008, 12:31 PM
Thank you for reply, but it did not make it working.

PS I needed to cast item to GridCommandItem, not to GridDataItem.
0
librido
Top achievements
Rank 1
answered on 22 Sep 2008, 10:37 AM
If your datasource is found in your page load , it will trigger it before entering in the edit mode.. therefore you will never enter in edit mode.
Tags
Grid
Asked by
QualiWareUA
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
QualiWareUA
Top achievements
Rank 1
librido
Top achievements
Rank 1
Share this question
or