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

How to retrieve updated data in RadGrid

4 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DQ
Top achievements
Rank 1
DQ asked on 16 Aug 2012, 10:09 PM


Can someone show me how to retrieve data back from RadGrid row.  This should not be a night-mare, but it turn out to be.

And looks like we have no support here from Telerik, after we bought the products.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Aug 2012, 06:30 AM
Hi,

I suppose you want to access the values in UpdateCommand. Here is the sample code.
C#:
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
  GridEditableItem editItem = e.Item as GridEditableItem;
  TextBox txt = (TextBox)editItem["EmployeeID"].Controls[0];//accessing the column
  string value = txt.Text;
  Hashtable newValues = new Hashtable();
  e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editItem);//using ExtractValuesFromItem method
  string id = newValues["EmployeeID"].ToString();
}

Thanks,
Shinu.
0
Sanjeev
Top achievements
Rank 1
answered on 24 Aug 2012, 11:46 AM
grideditableitem datatype is not available in my  updateCommand function.. can you please tell me the reason
0
Andrey
Telerik team
answered on 29 Aug 2012, 08:45 AM
Hi,

The easiest way to access row values is on the ItemDataBound event:

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            string value = dataItem["ColumnUniqueName"].Text;
        }
    }

You should substitute "ColumnUniqueName" with the name of the column in which the cell is located. Additionally, in order to use the GridEditableItem and GridDataItem classes you should include the Telerik.Web.UI namespace in your file:

using Telerik.Web.UI;

If you want to receive response within a guaranteed time frame, you should open support threads, instead of forums. The forum threads are not with guaranteed time reply.

Additionally, as I see from your account all support thread are marked with "Closed by client" tag. Is there any thread that you are still waiting reply for?

Regards,
Andrey
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.
0
Sanjeev
Top achievements
Rank 1
answered on 30 Aug 2012, 06:28 AM
Thanks Admin. its now working fine for me
Tags
Grid
Asked by
DQ
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sanjeev
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or