Skip to main content

Command Palette

Search for a command to run...

Day 3: Routing & Navigation

Published
1 min read

Learn how to navigate between pages, use route parameters, and create dynamic URLs.

What is Routing?

  • Routing maps URLs to Blazor components (e.g., /counterCounter.razor).

  • Components become pages when you add the @page directive.

Basic Routing

Route Parameters

NavigationManager

NavLink Component

Practice Task

Create a ProductPage Component:

  1. Define a route /product/{Id}.

  2. Display the product ID from the URL.

  3. Add a button to go back to the home page.

Solution

Common Issues (For Beginners)

Key Takeaways

  • @page Directive: Turns a component into a routable page.

  • Route Parameters: Capture values from the URL with {ParameterName}.

  • NavigationManager: Navigate between pages programmatically.

  • NavLink: Create styled navigation links.

More from this blog

আপনার প্রোডাক্টিভিটি বাড়ান ১০ গুণ!

৫০টি ফ্রি AI টুল — এখন কাজ হবে ১০ গুণ দ্রুত ও স্মার্টভাবে! 1. ChatGPT – যেকোনো লেখা বা প্রশ্নের উত্তর দিতে পারে।2. Canva AI – ডিজাইন তৈরি ও কনটেন্ট সাজাতে AI সহায়তা।3. Pictory – লেখা থেকে অটো ভিডিও তৈরি করে।4. Copy. ai – মার্কেটিং কপিরাইটিং বা ব্ল...

Apr 28, 20253 min read

Abdullah’s Tech Haven

14 posts

Discover simplified insights, tips, and tutorials on .NET Core, Blazor, Entity Framework Core, SQL, and C# at Abdullah’s Tech Haven—a practical hub for tech enthusiasts and developers!