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

Edit mode

2 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alewx
Top achievements
Rank 1
Alewx asked on 06 Jul 2011, 11:17 PM
I jave edit button on my raddatagrid
   <telerik:GridEditCommandColumn HeaderText="Edit" UniqueName="paramsEditCollumn">
  </telerik:GridEditCommandColumn>

When i trying to do an edit with http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx - its not working. Most funny that it is working only if im step-bysteb debugging javascript doubleclick function, or making alert($find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow));

When im trying to do this with the help of postback:

   function RowDblClick(sender, eventArgs) {
              
               __doPostBack("<%= RadGrid1
.UniqueID %>", "RowDblClicked:" + eventArgs.get_itemIndexHierarchical());
            }

    protected override void RaisePostBackEvent(IPostBackEventHandler source, string eventArgument)
    {
        base.RaisePostBackEvent(source, eventArgument);
        if (source == this.rgParams && eventArgument.IndexOf("RowDblClicked") != -1)
        {
            GridDataItem item = rgParams.Items[int.Parse(eventArgument.Split(':')[1])];
            item.Edit=true;
            rgParams.Rebind();
        }
    }  


Its not working too.

lol

whats wrong with this dg?

Devs give pls answer.

2 Answers, 1 is accepted

Sort by
0
Alewx
Top achievements
Rank 1
answered on 06 Jul 2011, 11:22 PM
LOLUPDATE:

Datagrid edit mode working if i editing method RowDblClick on http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx

to

alert($find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow); );

After alert window was close - row switched to edit mode.

Something wrong
0
Vasil
Telerik team
answered on 12 Jul 2011, 11:29 AM
Hi Alewx,

When you use GridEditCommandColumn, and you click on the edit link for given record, it will get into edit mode. But "editedRow" JavaScript variable that is used in the example, will not be changed, because in the example it is changed on RowDblClick event.
So after the callback, the row will be in edit mode, but the editedRow will be null. And if you click somewhere on the grid RowClick will be fired but (editedRow && hasChanges) well be "false" and you will not be able to update the item.

There are two workarounds that could be used:
1) Instead of GridEditCommandColumn, use GridTemplateColumn with link that to execute JavaScript function similar to RowDblClick handler that is used in the example. This will allow you to set editedRow before the callback.
2) Use a hidden input, to send the index of the edited item, from server to client. Or instead of using an input, you could register startup script from the server, to set the editedRow after the callback.

Best wishes,
Vasil
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Alewx
Top achievements
Rank 1
Answers by
Alewx
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or