Skip to content

Commit 3aaac42

Browse files
committed
988109: Updated the code snippet in the Menu Bar Component
1 parent 4144e80 commit 3aaac42

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

blazor/menu-bar/data-source-binding-and-custom-menu-items.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ In the following example, the **id**, **pId**, and **text** columns from self-re
3434
new CustomMenuItem{ Id = "parent1", Text = "Events" },
3535
new CustomMenuItem{ Id = "parent2", Text = "Movies" },
3636
new CustomMenuItem{ Id = "parent3", Text = "Directory" },
37-
new CustomMenuItem{ Id = "parent4", Text = "Queries", ParentId = "null" },
38-
new CustomMenuItem{ Id = "parent5", Text = "Services", ParentId = "null" },
37+
new CustomMenuItem{ Id = "parent4", Text = "Queries", ParentId = null },
38+
new CustomMenuItem{ Id = "parent5", Text = "Services", ParentId = null },
3939
new CustomMenuItem{ Id = "parent6", Text = "Conferences", ParentId = "parent1" },
4040
new CustomMenuItem{ Id = "parent7", Text = "Music", ParentId = "parent1" },
4141
new CustomMenuItem{ Id = "parent8", Text = "Workshops", ParentId = "parent1" },
@@ -69,6 +69,7 @@ In the following example, the **id**, **pId**, and **text** columns from self-re
6969
7070
7171
```
72+
{% previewsample "https://blazorplayground.syncfusion.com/embed/BjLIsZrssHctKuMX?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
7273

7374
![Data Binding in Blazor MenuBar](./images/blazor-menubar-data-binding.png)
7475

@@ -103,8 +104,8 @@ When using TValue with CustomMenuItem in the [MenuTemplates](https://help.syncfu
103104
new CustomMenuItem{ Id = "parent1", Text = "Events"},
104105
new CustomMenuItem{ Id = "parent2", Text = "Movies" },
105106
new CustomMenuItem { Id = "parent3", Text = "Directory" },
106-
new CustomMenuItem { Id = "parent4", Text = "Queries", ParentId = "null" },
107-
new CustomMenuItem { Id = "parent5", Text = "Services", ParentId = "null" },
107+
new CustomMenuItem { Id = "parent4", Text = "Queries", ParentId = null },
108+
new CustomMenuItem { Id = "parent5", Text = "Services", ParentId = null },
108109
new CustomMenuItem { Id = "parent6", Text = "Conferences", ParentId = "parent1" },
109110
new CustomMenuItem { Id = "parent7", Text = "Music", ParentId = "parent1" },
110111
new CustomMenuItem { Id = "parent8", Text = "Workshops", ParentId = "parent1" },
@@ -136,7 +137,7 @@ When using TValue with CustomMenuItem in the [MenuTemplates](https://help.syncfu
136137
foreach (var item in menuItems)
137138
{
138139
var clonedItem = menuDict[item.Id];
139-
if (!string.IsNullOrEmpty(item.ParentId) && item.ParentId != "null")
140+
if (!string.IsNullOrEmpty(item.ParentId) && item.ParentId != null)
140141
{
141142
if (menuDict.ContainsKey(item.ParentId))
142143
{
@@ -196,6 +197,7 @@ When using TValue with CustomMenuItem in the [MenuTemplates](https://help.syncfu
196197
}
197198
}
198199
```
200+
{% previewsample "https://blazorplayground.syncfusion.com/embed/LtBeMjBiMnvjKgoI?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
199201

200202
![Blazor MenuBar with Self-Referential Data with CustomMenuItem TValue in MenuTemplate](./images/blazor-menubar-self-referential-data.png)
201203

@@ -225,7 +227,7 @@ To customize Menu Bar items in your application, set your customized template us
225227
@{
226228
if (MenuItems.Url != null)
227229
{
228-
<img class="e-avatar e-avatar-small" src="@UriHelper.ToAbsoluteUri($"images/menu-bar/{MenuItems.Url}.png")" />
230+
<img class="e-avatar e-avatar-small" src="@MenuItems.Url" />
229231
}
230232
<span style="width:100%;">@MenuItems.Value</span>
231233
if (MenuItems.Count != null)
@@ -263,10 +265,10 @@ To customize Menu Bar items in your application, set your customized template us
263265
Value = "Products",
264266
Options = new List<CategoryModel>
265267
{
266-
new CategoryModel { Value= "JavaScript", Url= "javascript" },
267-
new CategoryModel { Value= "Angular", Url= "angular" },
268-
new CategoryModel { Value= "ASP.NET Core", Url= "core" },
269-
new CategoryModel { Value= "ASP.NET MVC", Url= "mvc" }
268+
new CategoryModel { Value= "JavaScript", Url= "https://ej2.syncfusion.com/demos/src/menu/images/javascript.png" },
269+
new CategoryModel { Value= "Angular", Url= "https://ej2.syncfusion.com/demos/src/menu/images/angular.png" },
270+
new CategoryModel { Value= "ASP.NET Core", Url= "https://ej2.syncfusion.com/demos/src/menu/images/core.png" },
271+
new CategoryModel { Value= "ASP.NET MVC", Url= "https://ej2.syncfusion.com/demos/src/menu/images/mvc.png" }
270272
}
271273
},
272274
new CategoryModel {
@@ -376,5 +378,6 @@ To customize Menu Bar items in your application, set your customized template us
376378
</style>
377379
378380
```
381+
{% previewsample "https://blazorplayground.syncfusion.com/embed/VXryiDLMBRagHDoZ?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
379382

380383
![Blazor MenuBar with Custom Item](./images/blazor-menubar-custom-item.png)

0 commit comments

Comments
 (0)