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
Copy file name to clipboardExpand all lines: blazor/autocomplete/getting-started-with-web-app.md
+73-46Lines changed: 73 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ documentation: ug
9
9
10
10
# Getting Started with Blazor AutoComplete in Blazor Web App
11
11
12
-
This section briefly explains about how to include [Blazor AutoComplete](https://www.syncfusion.com/blazor-components/blazor-autocomplete) component in your Blazor Web App using [Visual Studio](https://visualstudio.microsoft.com/vs/) and Visual Studio Code.
12
+
This section briefly explains about how to include [Blazor AutoComplete](https://www.syncfusion.com/blazor-components/blazor-autocomplete) component in your Blazor Web App using [Visual Studio](https://visualstudio.microsoft.com/vs/), [Visual Studio Code](https://code.visualstudio.com/), and the [.NET CLI](https://learn.microsoft.com/en-us/dotnet/core/tools/).
13
13
14
14
{% tabcontents %}
15
15
@@ -21,15 +21,15 @@ This section briefly explains about how to include [Blazor AutoComplete](https:/
21
21
22
22
## Create a new Blazor Web App in Visual Studio
23
23
24
-
You can create a **Blazor Web App** using Visual Studio 2022 via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=vs) or the [Syncfusion<supstyle="font-size:70%">®</sup> Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-integration/template-studio).
24
+
You can create a **Blazor Web App** using Visual Studio 2022 via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vs) or the [Syncfusion<supstyle="font-size:70%">®</sup> Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-integration/template-studio).
25
25
26
-
You need to configure the corresponding[Interactive render mode](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0#render-modes) and [Interactivity location](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=vs) while creating a Blazor Web Application.
26
+
Configure the appropriate[Interactive render mode](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-10.0#render-modes) and [Interactivity location](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vs) while creating a Blazor Web App.
27
27
28
28
## Install Syncfusion<supstyle="font-size:70%">®</sup> Blazor DropDowns and Themes NuGet in the App
29
29
30
-
To add **Blazor AutoComplete**component in the app, open the NuGet package manager in Visual Studio (*Tools → NuGet Package Manager → Manage NuGet Packages for Solution*), search and install [Syncfusion.Blazor.DropDowns](https://www.nuget.org/packages/Syncfusion.Blazor.DropDowns/) and [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes/).
30
+
To add the **Blazor AutoComplete** component in the app, open the NuGet package manager in Visual Studio (*Tools → NuGet Package Manager → Manage NuGet Packages for Solution*), then search and install [Syncfusion.Blazor.DropDowns](https://www.nuget.org/packages/Syncfusion.Blazor.DropDowns/) and [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes/).
31
31
32
-
If you utilize`WebAssembly or Auto` render modes in the Blazor Web App need to be install Syncfusion<supstyle="font-size:70%">®</sup> Blazor components NuGet packages within the client project.
32
+
If using the`WebAssembly or Auto` render modes in the Blazor Web App, install Syncfusion<supstyle="font-size:70%">®</sup> Blazor components NuGet packages in the client project.
33
33
34
34
Alternatively, you can utilize the following package manager command to achieve the same.
N> Syncfusion<supstyle="font-size:70%">®</sup> Blazor components are available in [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). Refer to [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for available NuGet packages list with component details.
45
+
N> Syncfusion<supstyle="font-size:70%">®</sup> Blazor components are available in the [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). Refer to the[NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for available NuGet packages list with component details.
## Create a new Blazor Web App in Visual Studio Code
56
56
57
-
You can create a **Blazor Web App** using Visual Studio Code via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=vsc) or the [Syncfusion<supstyle="font-size:70%">®</sup> Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-code-integration/create-project).
57
+
You can create a **Blazor Web App** using Visual Studio Code via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vsc) or the [Syncfusion<supstyle="font-size:70%">®</sup> Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-code-integration/create-project).
58
58
59
-
You need to configure the corresponding [Interactive render mode](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-8.0#render-modes) and [Interactivity location](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=vsc) while creating a Blazor Web Application.
59
+
Configure the appropriate interactive render mode and interactivity location when setting up a Blazor Web App. For detailed information, refer to the [interactive render mode documentation](https://blazor.syncfusion.com/documentation/common/interactive-render-mode).
60
60
61
61
For example, in a Blazor Web App with the `Auto` interactive render mode, use the following commands.
62
62
@@ -70,11 +70,9 @@ cd BlazorWebApp.Client
70
70
{% endhighlight %}
71
71
{% endtabs %}
72
72
73
-
N> For more information on creating a **Blazor Web App** with various interactive modes and locations, refer to this [link](https://blazor.syncfusion.com/documentation/getting-started/blazor-web-app?tabcontent=visual-studio-code#render-interactive-modes).
74
-
75
73
## Install Syncfusion<supstyle="font-size:70%">®</sup> Blazor DropDowns and Themes NuGet in the App
76
74
77
-
If you utilize`WebAssembly` or `Auto` render modes in the Blazor Web App need to be install Syncfusion<supstyle="font-size:70%">®</sup> Blazor components NuGet packages within the client project.
75
+
If using the`WebAssembly` or `Auto` render modes in the Blazor Web App, install Syncfusion<supstyle="font-size:70%">®</sup> Blazor components NuGet packages within the client project.
78
76
79
77
* Press <kbd>Ctrl</kbd>+<kbd>`</kbd> to open the integrated terminal in Visual Studio Code.
80
78
* Ensure you’re in the project root directory where your `.csproj` file is located.
@@ -92,20 +90,69 @@ dotnet restore
92
90
93
91
{% endtabs %}
94
92
95
-
N> Syncfusion<supstyle="font-size:70%">®</sup> Blazor components are available in [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). Refer to [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for available NuGet packages list with component details.
93
+
N> Syncfusion<supstyle="font-size:70%">®</sup> Blazor components are available in [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). Refer to the [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for the available NuGet packages list with component details.
96
94
97
95
{% endtabcontent %}
98
96
99
-
{% endtabcontents %}
97
+
{% tabcontent .NET CLI %}
100
98
101
-
## Register Syncfusion<supstyle="font-size:70%">®</sup> Blazor Service
99
+
### Prerequisites
100
+
101
+
Latest version of the [.NET SDK](https://dotnet.microsoft.com/en-us/download). If you previously installed the SDK, you can determine the installed version by executing the following command in a command prompt (Windows) or terminal (macOS) or command shell (Linux).
102
+
103
+
{% tabs %}
104
+
{% highlight c# tabtitle=".NET CLI" %}
105
+
106
+
dotnet --version
107
+
108
+
{% endhighlight %}
109
+
{% endtabs %}
110
+
111
+
### Create a Blazor Web App using .NET CLI
112
+
113
+
Run the following command to create a new Blazor Web App in a command prompt (Windows) or terminal (macOS) or command shell (Linux).
102
114
103
-
| Interactive Render Mode | Description |
104
-
| -- | -- |
105
-
| WebAssembly or Auto | Open **~/_Imports.razor** file from the client project.|
106
-
| Server | Open **~/_import.razor** file, which is located in the `Components` folder.|
115
+
Configure the appropriate interactive render mode and interactivity location when setting up a Blazor Web Application. For detailed information, refer to the [interactive render mode documentation](https://blazor.syncfusion.com/documentation/common/interactive-render-mode).
107
116
108
-
Import the `Syncfusion.Blazor` and `Syncfusion.Blazor.DropDowns` namespace.
117
+
For example, in a Blazor Web App with the `Auto` interactive render mode, use the following commands.
118
+
119
+
{% tabs %}
120
+
{% highlight c# tabtitle="Blazor Web App" %}
121
+
122
+
dotnet new blazor -o BlazorWebApp -int Auto
123
+
cd BlazorWebApp
124
+
cd BlazorWebApp.Client
125
+
126
+
{% endhighlight %}
127
+
{% endtabs %}
128
+
129
+
This command creates a new Blazor Web App and places it in a new directory called `BlazorWebApp` inside your current location. See the [Create a Blazor App](https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/create) and [dotnet new CLI command](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?pivots=cli&view=aspnetcore-10.0) topics for more details.
130
+
131
+
### Install Syncfusion<supstyle="font-size:70%">®</sup> Blazor DropDowns and Themes NuGet in the App
132
+
133
+
Here's an example of how to add the **Blazor AutoComplete** component to the application by using the following commands in a command prompt (Windows), terminal (Linux and macOS), or PowerShell to install the [Syncfusion.Blazor.DropDowns](https://www.nuget.org/packages/Syncfusion.Blazor.DropDowns/) and [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes/) NuGet packages. See [Install and manage packages using the dotnet CLI](https://learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-dotnet-cli) for more details.
134
+
135
+
If using the `WebAssembly` or `Auto` render modes in the Blazor Web App, install Syncfusion<supstyle="font-size:70%">®</sup> Blazor component NuGet packages in the client project.
N> Syncfusion<supstyle="font-size:70%">®</sup> Blazor components are available in [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). Refer to the [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for the available NuGet package list with component details.
148
+
149
+
{% endtabcontent %}
150
+
151
+
{% endtabcontents %}
152
+
153
+
### Add Import Namespaces
154
+
155
+
Open the **~/_Imports.razor** file in the client project and import the `Syncfusion.Blazor` and `Syncfusion.Blazor.DropDowns` namespaces.
109
156
110
157
{% tabs %}
111
158
{% highlight C# tabtitle="~/_Imports.razor" %}
@@ -116,9 +163,11 @@ Import the `Syncfusion.Blazor` and `Syncfusion.Blazor.DropDowns` namespace.
116
163
{% endhighlight %}
117
164
{% endtabs %}
118
165
119
-
Now, register the Syncfusion<supstyle="font-size:70%">®</sup> Blazor Service in the **~/Program.cs** file of your Blazor Web App.
166
+
## Register Syncfusion<supstyle="font-size:70%">®</sup> Blazor Service
167
+
168
+
Register the Syncfusion<supstyle="font-size:70%">®</sup> Blazor Service in the **~/Program.cs** file of your Blazor Web App.
120
169
121
-
If the **Interactive Render Mode** is set to `WebAssembly` or `Auto`, you need to register the Syncfusion<supstyle="font-size:70%">®</sup> Blazor service in both **~/Program.cs** files of your Blazor Web App.
170
+
If the **Interactive Render Mode** is set to `WebAssembly` or `Auto`, register the Syncfusion<supstyle="font-size:70%">®</sup> Blazor service in both **~/Program.cs** files of your Blazor Web App.
If the **Interactive Render Mode** is set to `Server`, your project will contain a single **~/Program.cs** file. So, you should register the Syncfusion<supstyle="font-size:70%">®</sup> Blazor Service only in that **~/Program.cs** file.
The theme stylesheet and script can be accessed from NuGet through [Static Web Assets](https://blazor.syncfusion.com/documentation/appearance/themes#static-web-assets). Include the stylesheet reference in the `<head>` section and the script reference at the end of the `<body>` in the **~/Components/App.razor** file as shown below:
@@ -193,16 +221,15 @@ N> Check out the [Blazor Themes](https://blazor.syncfusion.com/documentation/app
Add the Syncfusion<supstyle="font-size:70%">®</sup> Blazor AutoComplete component in the **~Pages/.razor** file. If an interactivity location as `Per page/component` in the web app, define a render mode at the top of the `~Pages/.razor` component, as follows:
224
+
Add the Syncfusion<supstyle="font-size:70%">®</sup> Blazor AutoComplete component in the **~/Components/Pages/*.razor** file. If the interactivity location is set to `Per page/component` in the Web App, define a render mode at the top of the `~Pages/*.razor` component, as follows:
197
225
198
226
| Interactivity location | RenderMode | Code |
199
227
| --- | --- | --- |
200
228
| Per page/component | Auto |@rendermode InteractiveAuto |
N> If an **Interactivity Location** is set to `Global` and the **Render Mode** is set to `Auto` or `WebAssembly` or `Server`, the render mode is configured in the `App.razor` file by default.
232
+
N> If an **Interactivity Location** is set to `Global` and the **Render Mode** is set to `Auto` or `WebAssembly`, the render mode is configured in the `App.razor` file by default.
206
233
207
234
{% tabs %}
208
235
{% highlight razor %}
@@ -240,7 +267,7 @@ N> If an **Interactivity Location** is set to `Global` and the **Render Mode** i
240
267
{% endhighlight %}
241
268
{% endtabs %}
242
269
243
-
* Press <kbd>Ctrl</kbd>+<kbd>F5</kbd> (Windows) or <kbd>⌘</kbd>+<kbd>F5</kbd> (macOS) to launch the application. This will render the Syncfusion<supstyle="font-size:70%">®</sup> Blazor AutoComplete component in your default web browser.
270
+
* Press <kbd>Ctrl</kbd>+<kbd>F5</kbd> (Windows) or <kbd>⌘</kbd>+<kbd>F5</kbd> (macOS) to launch the application. This will render the Syncfusion<supstyle="font-size:70%">®</sup> Blazor AutoComplete component in the default web browser.
0 commit comments