August 5, 2026

Build a Complete App with ASP.Net, C#, SQL Lite – Part 10

In this part, we would cover User profile. We’ll be able to display the login user on the header section and provide link to logout and profile.

However, before we continue on this section, I would like to show you how to display Name in dropdown list instead of Id. For instance, if you go to New Patient, you will notice the in the Country select list, country ids are displayed rather than names.

To fix this:

Step 1 – Open the PatientController.cs file and locate the code below:

Select List - Change Id to Name
Select List – Change Id to Name

 

Step 2 – Simply change the CountryId to Name in the two places circled

Step 3 – In the Create.cshtml page for Patient, change ViewBag.CountryId to ViewBag.Name in the dropdown list section.

kindsonthegenius

Kindson Munonye is a software engineer and technical author covering machine learning, statistics, REST APIs, Python, and software engineering. He publishes free tutorials on The Genius Blog and live classes on Alkademy. GitHub · LinkedIn · About · Alkademy

View all posts by kindsonthegenius →
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted