Get data from a model and display it as dropdown on client side in Razor

Hi, how do I retrieve data in a database from a model and show it in as my dropdown values in my razor view? For example, I have model called "Block", and I have a model called "ClassroomLocation", then on client side, there's a dropdown with "Block" as selection. But the values I'm not sure how to generate it based on the data stored inside "Block". Do I have to use something called model binding? These two models are also non-relational to each other.
2 Replies
friedice
friedice2y ago
So you successfully grabbed the data from backend right Since it's a drop-down probably like a list of block Then yeah bind that
CoreVisional
CoreVisional2y ago
@friedice Is it the [BindProperty] attribute? If so, which model do I put the "bind" on? I'm assuming it's the "Block" model right?
Want results from more Discord servers?
Add your server
More Posts
❔ Help with DI, i have different connection strings but same behavior for query DBHi, i want to instance the same query service but with different configuration and i have no idea ho❔ Help with stream reading and writing and displaying information at a certain timeSo I am currently doing stream writing and reading and I need it when the user types the student ID ✅ Foreign key not workingHi, I tried making a foreign key in my table, to another table which I made but it does not work as ✅ Shorten data querying lineHi, how do I shorten this line that's querying for data? Like, instead of putting them into one long❔ Blazor JS Interop - Return RTCPeerConnection from js to Blazor in order to close itHi, I've quite a complex task: In my Blazor application I use javascript to read webrtc data produce✅ Authentication with CookiesI'm playing around with cookies to get a better understanding. My code: ``` var builder = WebApplic❔ need help with visual studio communityhi i have multipul q 1- i have mac is there way to have community on it 2- please hoe to make 3 buUsing the new INumber interface to determine if an object is a number without having the generic argWith .net7 we now have the INumber<TSelf> interface which is pretty cool, and I thought I found a pl✅ Polyphormism?Is this polyphornism? I am not sure, I was told I should make something like this ```cs public abst❔ I'm not sure what's wrong with my codeI don't know why Thompson still pop up only T should be. (The blue outline is what I'm trying to do)