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
In some scenarios, you might want to conditionally show or hide command buttons in a [Grid for Blazor](https://docs.telerik.com/blazor-ui/components/grid/overview) based on the data of the current row. For instance, you may want to display a delete button only for items that meet certain criteria. This article demonstrates how to achieve this behavior by using the context of the command column.
13
+
In some scenarios, you might want to conditionally show or hide command buttons in a [Grid for Blazor](slug://grid-overview) based on the data of the current row. For instance, you may want to display a delete button only for items that meet certain criteria. This article demonstrates how to achieve this behavior by using the context of the command column.
14
14
15
15
This knowledge base article also answers the following questions:
16
16
- How can I hide a GridCommandButton based on a row value in Blazor?
@@ -23,8 +23,12 @@ To conditionally show or hide command buttons in a Grid for Blazor, use the cont
CustomCommandResult = new MarkupString(CustomCommandResult + string.Format("<br />Custom command triggered for item {0}", (args.Item as SampleData).ID));
SampleData theUpdatedItem = args.Item as SampleData;
71
75
@@ -95,11 +99,11 @@ To conditionally show or hide command buttons in a Grid for Blazor, use the cont
95
99
for (int i = 1; i < 50; i++)
96
100
{
97
101
_data.Add(new SampleData()
98
-
{
99
-
ID = i,
100
-
Name = "name " + i,
101
-
HireDate = DateTime.Now.AddDays(-i)
102
-
});
102
+
{
103
+
ID = i,
104
+
Name = "name " + i,
105
+
HireDate = DateTime.Now.AddDays(-i)
106
+
});
103
107
}
104
108
}
105
109
@@ -122,5 +126,5 @@ To conditionally show or hide command buttons in a Grid for Blazor, use the cont
122
126
If you prefer not to remove the button from the DOM but simply hide it, you can conditionally set the `Class` parameter of the `GridCommandButton` tag and utilize CSS to hide the button.
0 commit comments