Skip to content

Commit e536b01

Browse files
Merge pull request #7222 from syncfusion-content/983330-HowTo2UB
983330: Updated the UG for How-To folder Content and Samples in DataGrid
2 parents 712075a + 0e64ba9 commit e536b01

File tree

5 files changed

+104
-86
lines changed

5 files changed

+104
-86
lines changed

blazor/datagrid/how-to/send-context-as-additional-parameters-from-events.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
---
22
layout: post
3-
title: Send context as parameters from events in Blazor DataGrid | Syncfusion
4-
description: Checkout the documentation for sending context as additional parameters from events in Blazor DataGrid in Visual Side using .NET CLI and much more.
3+
title: Send Context as Parameters in Blazor DataGrid | Syncfusion
4+
description: Learn how to Pass current row context from Blazor DataGrid events using edit templates to update bound fields instantly.
55
platform: Blazor
66
control: DataGrid
77
documentation: ug
88
---
99

10-
# Sending context as additional parameters in Blazor DataGrid events
10+
# Sending Context as additional Parameters in Blazor DataGrid Events
1111

12-
The Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor DataGrid offers flexibility to pass additional context information during events. This capability is especially useful for dynamically updating Grid data based on interactions with other components, enabling seamless, real-time data modifications within the Grid.
12+
The Syncfusion<sup style="font-size:70%">&reg;</sup> Blazor DataGrid supports passing the current row context to event handlers. This approach is useful for updating Grid fields based on interactions inside the edit dialog, enabling immediate, in-place updates to the bound data.
1313

1414
To implement this, follow these steps:
1515

1616
1. Place the [ComboBox](https://blazor.syncfusion.com/documentation/combobox/getting-started-with-web-app) inside the Grid's `GridEditSettings.Template` to customize the edit form.
1717

1818
2. Bind the ComboBox’s `ValueChange` event to a handler method.
1919

20-
3. The method receives two parameters:
20+
3. The handler receives:
21+
* args: Event arguments that include the new ComboBox value and the selected item.
22+
* context: The template context cast to the row type (Order) and stored in a local variable (order).
2123

22-
* **args**: The event arguments containing the new `ComboBox` value and selected item.
23-
24-
* **Context**: The current row data is referenced by the variable **Order**, which is cast from the template’s context object as **Order**.
25-
26-
4. Within the event handler, you can update properties of the current row, such as **ShipCity**, **ShipCountry** based on the selected `ComboBox` value. The Grid is directly bound to the data object, so changes made to this object are immediately reflected in the Grid UI.
27-
28-
The following example demonstrates this approach:
24+
4. Inside the handler, update properties of the current row (for example, ShipCity and ShipCountry) based on the selected ComboBox value. Because the Grid is bound to the same data object instance, changes are reflected immediately in the Grid UI.
2925

3026
{% tabs %}
3127
{% highlight razor tabtitle="Index.razor" %}
@@ -154,4 +150,4 @@ Height="600" @ref="Grid">
154150
{% endhighlight %}
155151
{% endtabs %}
156152

157-
{% previewsample "https://blazorplayground.syncfusion.com/embed/hZVoXHDepIVbDBhd?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
153+
{% previewsample "https://blazorplayground.syncfusion.com/embed/hZhIXYrfAswqgaHD?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}

0 commit comments

Comments
 (0)