Navigate to Page in new Tab

Hi!

In the editor for the navigation menu, it is possible not to only define which page is to be shown but also if it is desired to open that page in a new tab of the browser. That works fine!

However, in the application itself (e.g. the click on a button event), when I select the "Navigate to Page" action, I can only select the page to be navigated to as well as the parameters that are goning to be passed to it, but there is no way so select if the navigation should happen in a new tab.

Can this somehow be done?

Thanks for your help!

Best regards,

Joe

Hi @JustJoe,

This can't be done with the Navigate to page action. It can be done with the Link component though.

Thanks for your super-quick reply. That workaround with the link should also do... Thanks! :slight_smile:

I tried to use the Link component and basically it does work, however, I only see a blank page. The link in my case opens the URL:

https://localhost:5001/edit-account/8674

From the debugger, I can see that in the Load() method, the parameter Id that is passed to the page is interpreted as string, and not as int:

        var dcGetAccountByIdResult = await DC.GetAccountById(Id);
        account = dcGetAccountByIdResult;

Therefore, I get an error. How can I make page interpret the parameter as int when doing a link-based navigation?

I fixed this by adding a pratial implementation of a method that accepts string as parameter in the DataService class:

public partial class DatabaseService
    {
        public async Task<Models.Database.Account> GetAccountById(string id)
        {
            return await this.GetAccountById(int.Parse(id));
        }
    }

Is this the only way to "fix" this or is there a more elegant way that does not require custom code?

At the moment no. Blazor parameters are string by default.

...you mean int? right? String is not working, therefore I did the overloaded method that also acccepts string...

No, I mean string. That's why you convert the string to int. Radzen generates code to do that when one uses CRUD pages which are not utilizing dialogs.