Select theme:

Methods and StatementsLink to this section

Methods are the bread and butter of every Blazor application. You use them to query a database, respond to user actions, handle Blazor lifecycle events and more.

You can manage methods and their statements of your Blazor components or C# classes via Radzen Blazor Studio's Methods design mode.

To access Methods design mode open a .razor or .cs file and click the corresponding button in the design canvas toolbar.

Radzen Blazor Studio will display a dropdown with all methods that are accessible from the current class / component.

Radzen Blazor Studio lists methods that may be defined in other files (when you use partial classes for example).

Methods consist of statements - basically one or more lines of code that perform certain task. For example assignments, loops, if checks, try/catch blocks, method invocations et. al.

Radzen Blazor Studio allows you to visually edit a method by adding or removing statements to it.

Invoke a method and assign its result to a fieldLink to this section

Invoking a service method and assigning its result to a field is a common task in Blazor development. Here is how to do it with Radzen Blazor Studio.

  1. Open a .razor file and enter Methods design mode.
  2. Pick OnInitializedAsync from the Override dropdown. It lists all Blazor lifecycle methods which are not yet overridden by your component.
  3. Click the + button below the start box and pick Invoke from the popup.
  4. Select the Method you wish to invoke. Start typing its name and Radzen Blazor Studio will suggest you the available options - all methods of the injected services as well as the own methods of the current file.
  5. If the chosen method returns a value you can set Result as well. You can either pick an existing field or property to assign the result to or create a new one.
Invoke a method

Supported statementsLink to this section

Radzen Blazor Studio provides built-in support for the following statements.

AssignmentLink to this section

Assign values to existing fields, properties or variables.

DeclarationLink to this section

Declare method variables to store method or computation results.

IfLink to this section

Create C# if statements.

SwitchLink to this section

Create C# switch statements.

ForLink to this section

Create C# for loops.

ForEachLink to this section

Create C# foreach loops.

Do/WhileLink to this section

Create C# do/while loops.

WhileLink to this section

Create C# while loops.

InvokeLink to this section

Invoke own methods or methods of properties or fields.

NavigateLink to this section

Use the NavigationManager to navigate to a page. A page is a Blazor component with a @page directive.

Navigate BackLink to this section

Return to the previous page.

Try/CatchLink to this section

Create a try/catch block.

UsingLink to this section

Create a C# using statement.

NotifyLink to this section

Display a notification message. Uses the Radzen.Blazor library's NotificationService.

Open DialogLink to this section

Display a dialog. Uses the Radzen.Blazor library's DialogService.

Close DialogLink to this section

Closes the current dialog. Uses the Radzen.Blazor library's DialogService.

Open Context MenuLink to this section

Opens a context menu. Uses the Radzen.Blazor library's ContextMenuService.

Show TooltipLink to this section

Opens a tooltip. Uses the Radzen.Blazor library's TooltipService.

ExecuteLink to this section

Any other C# statement.

Important: statements that require the Radzen.Blazor component library are available only in applications that have Radzen.Blazor correctly installed and the required services registered.

© 2016-2026 Radzen Ltd. All Rights Reserved.
Designed and developed with ❤️ in Radzen Blazor Studio.
IP Geolocation by DB-IP

Select theme: