Back to Devexpress

ASPxDataUpdatingEventArgs.Keys Property

aspnet-devexpress-dot-web-dot-data-dot-aspxdataupdatingeventargs.md

latest6.4 KB
Original Source

ASPxDataUpdatingEventArgs.Keys Property

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

Declaration

csharp
public OrderedDictionary Keys { get; }
vb
Public ReadOnly Property Keys As OrderedDictionary

Property Value

TypeDescription
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.

asp-net-web-forms-grid-entitydatasource-and-common-scenarios/CS/GridEntityFramework/CustomEditingCapabilities.aspx.cs#L46

csharp
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();

asp-net-web-forms-grid-initialize-editor-conditionally/CS/WebApplication_Grid/CustomEditItem.aspx.cs#L14

csharp
ASPxGridView grid = (ASPxGridView)sender;
DataType dataType = (DataType)grid.GetRowValuesByKeyValue(e.Keys[0], "Type");

asp-net-web-forms-grid-create-master-detail-grid-at-runtime/CS/MasterDetailGrids/Default.aspx.cs#L131

csharp
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

csharp
{
    UpdateItem(e.Keys, e.NewValues);
    CancelEditing(e);

aspxgridview-use-external-buttons-to-edit-records/CS/Solution/Default.aspx.cs#L80

csharp
DataTable table = GetTable();
DataRow found = table.Rows.Find(e.Keys[0]);
found["Name"] = e.NewValues["Name"];

asp-net-web-forms-grid-entitydatasource-and-common-scenarios/VB/GridEntityFramework/CustomEditingCapabilities.aspx.vb#L46

vb
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()

asp-net-web-forms-grid-initialize-editor-conditionally/VB/WebApplication_Grid/CustomEditItem.aspx.vb#L16

vb
Dim grid As ASPxGridView = DirectCast(sender, ASPxGridView)
Dim dataType As DataType = CType(grid.GetRowValuesByKeyValue(e.Keys(0), "Type"), DataType)

asp-net-web-forms-grid-create-master-detail-grid-at-runtime/VB/MasterDetailGrids/Default.aspx.vb#L135

vb
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

vb
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

vb
Dim table As DataTable = GetTable()
Dim found As DataRow = table.Rows.Find(e.Keys(0))
found("Name") = e.NewValues("Name")

See Also

ASPxDataUpdatingEventArgs Class

ASPxDataUpdatingEventArgs Members

DevExpress.Web.Data Namespace