0

my project is made blazor server

I got a text editor that works with blazor(.razor) . But all my default pages are razor pages (.cshtml).

How to access with blazor(.razor) parameter in cshtml?

I initially used asp-for . And I tried to use url/{value} method through navlink. When I used navlink in cshtml, the button did not appear.

i find that no!

Is what I'm trying to do possible?

<a asp-page="./ViewBorad" asp-route-boradid="@Model.board.board_id" > AddText</a>

<li class="nav-item px-3">
    <NavLink class="nav-link" href="/MyPage/ViewBorad/@Model.board.board_id">
        <span class="oi oi-plus" aria-hidden="false"></span> ViewBorad
    </NavLink>
</li>

로다현
  • 125
  • 1
  • 12

1 Answers1

0

You can navigate to a Razor page from Blazor by using the NavigationManager.NavigateTo method which takes two parameters. The first parameter is the url to navigate to, including a parameter the called method gets, the second named forceLoad, which takes a boolean value... The default value is false, but you should pass a true value.

Search Google for the string enet stackoveflow Blazor OpenIDConnect, inspect the results where I show how to call a Razor page from a Razor component (Blazor), how to pass a parameter to and back.

Incidentally, you can also use the NavLink or the Html anchor element (a element) for this.

enet
  • 41,195
  • 5
  • 76
  • 113
  • is it possible accessing razor page (cshtml) to blazor(.razor) with navigationManager? – 로다현 Jun 30 '21 at 08:11
  • No, NavigationManager is an object of the Blazor framework , and you can't use it in Razor Pages Apps. I told you what to do in order to see how I'm doing it. Again, use Google search find my answers on Satckoverflow, and look for the code that redirects the execution flow from a Razor page to Blazor. – enet Jun 30 '21 at 08:17
  • Thank you for your response .i learned asp three week ago. your document is very hard What we can confirm is that the razor page itself is quite difficult on blazor. I have to finish this webpage project by next week. I don't know if this is a good way. Rather, it feels better to make a text editor with cshtml. What do you think? – 로다현 Jun 30 '21 at 08:47
  • https://stackoverflow.com/questions/54303437/redirecting-in-blazor-with-parameter this????? – 로다현 Jul 01 '21 at 00:22
  • Why do you use razor pages in a Blazor App ? Note: I'd suggest you explain yourself in details in the Korean language, and then use Google Translate to translate it into English, and then post here the translation. If possible, upload your application to Github, so I can inspect it. – enet Jul 01 '21 at 15:20
  • This is my first time making a web. However, I don't know how to do anything other than C#, so I don't want to use js, so I used blazor server as a basic project. However, as I followed the ms web document, razor page was used. i was stupid One of the concerns I have now is that the project is now a blazor server, but it does not include any understanding of this blazor server. Even the default blaozr layout will be deleted and a raozr page layout will be added. – 로다현 Jul 02 '21 at 00:28
  • And the text editor I asked in the first question just added the text editor used in the razor page... Of course, this is also currently in the process of modifying js. – 로다현 Jul 02 '21 at 00:28