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

Editmode is InPlace. Not getting the changed values

1 Answer 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkatesh
Top achievements
Rank 1
Venkatesh asked on 10 Dec 2012, 11:58 AM
Hi,
In the radgrid, i am using editmode = inplace.
sample aspx for edititemtemplate is:
<EditItemTemplate>
                      <telerik:RadTextBox ID="RadtxtPrdNumber" runat="server" Text='<%# Eval("ProductNumber") %>'>
                      </telerik:RadTextBox>
                  </EditItemTemplate>

In the updateCommand code i have the below:
GridEditableItem editedItem = (GridEditableItem)e.Item;
                string value = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ProductNumber"].ToString();
                          
                  
                DataTable ordersTable = this.OrderGridData;
  
                //Locate the changed row in the DataSource 
  
                string filter = "ProductNumber = '" + value + "'";
                  
                DataRow[] changedRows = ordersTable.Select(filter);
        Hashtable newValues = new Hashtable();
                //The GridTableView will fill the values from all editable columns in the hash 
                // in the below code newvalues is coming as empty 
                e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
  
                DataRow changedRow = changedRows[0];
                changedRow.BeginEdit();

The bolded line has newvalues as empty. i have changed few columns. How to retrieve the updated items?
Thanks

1 Answer, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 13 Dec 2012, 07:20 AM
Hello Venkatesh,

In order to achieve your scenario you should manually retrieve the RadtxtPrdNumber control value as shown below.
RadTextBox number = e.Item.FindControl("RadtxtPrdNumber") as RadTextBox;
string value = number.Text;

Note that the experienced behavior is expected. When using templates RadGrid ExtractValuesFromItem could not extract the values because it is unaware of which control value to extract. For example there could be multiple controls in the EditItemTemplate.

Kind regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Venkatesh
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Share this question
or