You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<ahref="/blazor/datagrid/how-to/calculate-column-value-based-on-other-columns">Calculate column value based on other columns</a>
2028
-
</li>
2029
2023
<li>
2030
2024
<ahref="/blazor/datagrid/how-to/using-dictionary-values-in-grid-datasource">Using dictionary values in datagrid datasource</a>
2031
2025
</li>
2032
2026
<li>
2033
2027
<ahref="/blazor/datagrid/how-to/upgrade-application-to-latest-version">Upgrade Application To Latest Version</a>
2034
2028
</li>
2035
-
<li>
2036
-
<ahref="/blazor/datagrid/how-to/custom-toolbar-items-with-text-name-same-as-default-toolbar-items">Custom toolbar items with text name same as default toolbar items</a>
2037
-
</li>
2038
2029
<li>
2039
2030
<ahref="/blazor/datagrid/how-to/render-grid-inside-tab-with-specific-height">Render DataGrid inside the Tab with specific height</a>
2040
2031
</li>
2041
-
<li>
2042
-
<ahref="/blazor/datagrid/how-to/provide-custom-data-source-and-enable-filter-option-for-drop-down-list">Provide custom data source and enabling filtering for DropDownList</a>
2043
-
</li>
2044
-
<li>
2045
-
<ahref="/blazor/datagrid/how-to/cascading-dropdownlist-with-grid-editing">Cascading DropDownList with DataGrid editing</a>
2046
-
</li>
2047
-
<li>
2048
-
<ahref="/blazor/datagrid/how-to/editing-with-template-column">Editing with template column</a>
<ahref="/blazor/datagrid/how-to/effectively-add-range-of-items-to-observable-collection">Effectively add a range of items into ObservableCollection</a>
2082
2049
</li>
2083
-
<li>
2084
-
<ahref="/blazor/datagrid/how-to/hide-command-column-based-on-record-detail">Hide command column in record based on record detail</a>
2085
-
</li>
2086
2050
<li>
2087
2051
<ahref="/blazor/datagrid/how-to/define-events-programmatically">Define the GridEvents programmatically in DataGrid</a>
2088
2052
</li>
2089
-
<li>
2090
-
<ahref="/blazor/datagrid/how-to/hide-detail-template-icon-when-record-details-has-no-record">Hide detail template icon when record details has no record</a>
2091
-
</li>
2092
2053
<li>
2093
2054
<ahref="/blazor/datagrid/how-to/css-isolation-for-grid">CSS Isolation for DataGrid</a>
The `Template` allowscustomizinghowacolumn's content is rendered, and it provides access to the current row'sdatathroughthe**context**parameter. Thismakesitpossibletodefineinlineexpressionsorlogicthatcomputevaluesbasedonotherfieldsinthesamerow.
## How to get the row object by clicking on the template element
739
799
740
800
TheGridcomponentallowsyoutoretrievetherowobjectoftheselectedrecordwhenclickingona [Template](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Template) element. This feature can be useful when you need to perform custom actions based on the selected record.
> The Grid component does not support adding a new record using the command column. Because, the command column, along with the command buttons, will be rendered only after the record is created. As a result, Grid only supported edit, delete, cancel, and update options in the command column.
207
+
> The Grid component does not support adding a new record using the command column. Because, the command column, along with the command buttons, will be rendered only after the record is created. As a result, Grid only supported edit, delete, cancel, and update options in the command column.
208
+
209
+
## Hide the command column button in a specific record
210
+
211
+
In the Syncfusion Blazor DataGrid, command columns are used to perform CRUD operations on records, such as editing or deleting. Sometimes, you may want to hide the command buttons for specific records based on certain conditions. This can be done by using the [`RowDataBound`](https://blazor.syncfusion.com/documentation/datagrid/events#rowdatabound) event, which is triggered every time a row is created or updated in the Grid.
212
+
213
+
This is demonstrated in the following steps where the `RowDataBound` event is triggered when a record is created. Based on the record details, you can add a specific class name to that row and hide the command buttons using CSS styles.
214
+
215
+
* Use the `RowDataBound` event of the Grid to access each row's data at the time of rendering.
216
+
* Inside the event, check the value of the **Verified** column for the current record.
217
+
* Based on the value of the **Verified** column, if Verified is **false**, only the **Edit** button will be shown; otherwise **Delete** button will be shown.
218
+
* In order to hide buttons (**display: none** style to the buttons), CSS class is applied to the row inside the `RowDataBound` event based on the record condition using `addClass` method, and corresponding CSS rules are defined to hide the respective command buttons.
0 commit comments