C
C#2w ago
TeMi

✅ Connection razor and cs class

I'm trying to connect my razor using .NET MAUI Blazor so I'm trying to connect it to the cs class "Customer" so I can use the property there. I already used the @using "the namespace"
No description
19 Replies
leowest
leowest2w ago
the error seems very clear, what is your Customer class
TeMi
TeMiOP2w ago
No description
leowest
leowest2w ago
the customer used in here is not the same if you hover your mouse over it and go to definition it should tell you which one its using
TeMi
TeMiOP2w ago
Okay thanks!
leowest
leowest2w ago
also are you sure id is supposed to be a string and not a GUID or int
TeMi
TeMiOP2w ago
yeah for now I'm keeping it as string
TeMi
TeMiOP2w ago
ok its saying this
No description
TeMi
TeMiOP2w ago
and then looking here
No description
leowest
leowest2w ago
so you either referenced the wrong class or something else
TeMi
TeMiOP2w ago
hmm maybe Im somehow referencing the class inside itself
TeMi
TeMiOP2w ago
and i made sure to do this
No description
leowest
leowest2w ago
can you show the full code
TeMi
TeMiOP2w ago
FRICK I GOT I T so what I did was change my class name to customers with an s then in the razor I change the list name to that too for some reason customer was buggin
leowest
leowest2w ago
they are conflicting with each other's name that is not a good way to solve the problem ideally you would fully qualify the name but I would prefer to use a viewmodel for the page instead https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-9.0&tabs=visual-studio
TeMi
TeMiOP2w ago
Yeah and I also have a databasebroker class that has a list<customer> ok
leowest
leowest2w ago
which makes it even more interesting to use a viewmodel instead the link above explain how it works
TeMi
TeMiOP2w ago
thank you 🙏 i'll read over it
leowest
leowest2w ago
$close
MODiX
MODiX2w ago
If you have no further questions, please use /close to mark the forum thread as answered

Did you find this page helpful?