aspnet-devexpress-dot-web-dot-data-dot-aspxdataupdatingeventargs.md
Gets a dictionary of field name/value pairs that represent the primary key of the row to update.
Namespace : DevExpress.Web.Data
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public OrderedDictionary Keys { get; }
Public ReadOnly Property Keys As OrderedDictionary
| Type | Description |
|---|---|
| OrderedDictionary |
A OrderedDictionary object that contains field name/value pairs that represent the primary key of the row to be updated.
|
The following code snippets (auto-collected from DevExpress Examples) contain references to the Keys property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
protected void grid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) {
int productID = (int)e.Keys[grid.KeyFieldName];
Product product = DataContext.Products.Where(p => p.ProductID == productID).FirstOrDefault();
ASPxGridView grid = (ASPxGridView)sender;
DataType dataType = (DataType)grid.GetRowValuesByKeyValue(e.Keys[0], "Type");
cmd.Parameters.Add("@Discontinued", SqlDbType.Bit).Value = e.NewValues["Discontinued"];
cmd.Parameters.Add("@ProductID", SqlDbType.Int).Value = e.Keys[0];
cmd.Connection.Open();
asp-net-web-forms-gridview-custom-buttons-in-batch-edit-mode/CS/T114462/Default.aspx.cs#L59
{
UpdateItem(e.Keys, e.NewValues);
CancelEditing(e);
aspxgridview-use-external-buttons-to-edit-records/CS/Solution/Default.aspx.cs#L80
DataTable table = GetTable();
DataRow found = table.Rows.Find(e.Keys[0]);
found["Name"] = e.NewValues["Name"];
Protected Sub grid_RowUpdating(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxDataUpdatingEventArgs)
Dim productID As Integer = CInt(e.Keys(grid.KeyFieldName))
Dim product As Product = DataContext.Products.Where(Function(p) p.ProductID = productID).FirstOrDefault()
Dim grid As ASPxGridView = DirectCast(sender, ASPxGridView)
Dim dataType As DataType = CType(grid.GetRowValuesByKeyValue(e.Keys(0), "Type"), DataType)
cmd.Parameters.Add("@Discontinued", SqlDbType.Bit).Value = e.NewValues("Discontinued")
cmd.Parameters.Add("@ProductID", SqlDbType.Int).Value = e.Keys(0)
cmd.Connection.Open()
asp-net-web-forms-gridview-custom-buttons-in-batch-edit-mode/VB/T114462/Default.aspx.vb#L49
Protected Sub Grid_RowUpdating(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxDataUpdatingEventArgs)
UpdateItem(e.Keys, e.NewValues)
CancelEditing(e)
aspxgridview-use-external-buttons-to-edit-records/VB/Solution/Default.aspx.vb#L72
Dim table As DataTable = GetTable()
Dim found As DataRow = table.Rows.Find(e.Keys(0))
found("Name") = e.NewValues("Name")
See Also
ASPxDataUpdatingEventArgs Class