Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: April 23, 2024, 11:55 pm

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MVC .NET Labelfor
#1
MVC .NET Labelfor
I was wondering if anyone knew how I can access data stored in a variable in my model from my view?

Like for example :
Labelfor (model.subject,"English")

I want "English" to be taken from my model data like
Labelfor(model. subject, model.subjectobj.subject)

I have a subject in my model to enter the mark and I have a subject object in the same model which connects to a model that contains all the subjects.
So my view looks like this

(entering mark)
Subject: _______(text box)

I want my view to be able to access the data from subject object. Subject (string) and look like this:

(entering mark)
English :________(text box)


Any ideas? I'm using visual studio 2015
Reply
#2
RE: MVC .NET Labelfor
Sorry, I can't help. I've only worked with Windows Forms.
Reply
#3
RE: MVC .NET Labelfor
Maaan :,(((
I wrote something but it seems to be seriously somehow fucked. I'm trying to access data from another class using a foreign key from the class I'm working in. But the data retrieved seems to be null even after I've filled the database
Reply
#4
RE: MVC .NET Labelfor
I've worked with MVC .NET abit way back, I don't remember much now Sad . my opinion that no one asked for: it fucking sucks, the whole thing is microsoft trying to puts it's giant corp. dick into the web developing,...........It simply lacks choices.

you can try Django, rubyonrails, lots of other things that will have good documentation, support, and good community. unless it's for a certain job you're for, then you're fucked.
[Image: eUdzMRc.gif]
Reply
#5
RE: MVC .NET Labelfor
--edit--

I said a bunch of stuff about postback and data persistence. But I think I'm more likely to confuse you than to help, because I've used only Webforms in .ASP.

If you are just starting, and you are willing to switch to Web Forms, I will be able to help a lot-- in all modesty, I am bordering on rockstar status at this point. Smile

Otherwise, good luck. I'm actually watching Youtube videos about MVC. When I started building my homepage, I seriously considered using MVC, but I went with webforms instead. But MVC is really a very interesting approach and I might play around with it a little just for fun.
Reply
#6
RE: MVC .NET Labelfor
If you were using Spring MVC in Java I'd be able to help you but alas, I know two things about .NET: jack and shit.
Reply
#7
RE: MVC .NET Labelfor
@CD,
Of course I could've figured it out by myself provided I had visual studio 15 on my laptop (which I don't). It's not that I can't solve it, I can, it's just that now I have to wait a whole day to know what I did wrong. Appreciate the efforts though, thanks guys.
Reply
#8
RE: MVC .NET Labelfor
(May 29, 2016 at 7:19 am)bennyboy Wrote: --edit--

I said a bunch of stuff about postback and data persistence. But I think I'm more likely to confuse you than to help, because I've used only Webforms in .ASP.

If you are just starting, and you are willing to switch to Web Forms, I will be able to help a lot-- in all modesty, I am bordering on rockstar status at this point. Smile

Otherwise, good luck. I'm actually watching Youtube videos about MVC. When I started building my homepage, I seriously considered using MVC, but I went with webforms instead. But MVC is really a very interesting approach and I might play around with it a little just for fun.

I wouldn't really classify MVC as fun. But hey if you're the type to dig around a bit go for it, perhaps you'll stumble upon the solution to my problem and hey - win-win. Appreciate your effort.
Reply
#9
RE: MVC .NET Labelfor
(May 29, 2016 at 4:28 am)Marsellus Wallace Wrote: I've worked with MVC .NET abit way back, I don't remember much now Sad . my opinion that no one asked for: it fucking sucks, the whole thing is microsoft trying to puts it's giant corp. dick into the web developing,...........It simply lacks choices.

you can try Django, rubyonrails, lots of other things that will have good documentation, support, and good community. unless it's for a certain job you're for, then you're fucked.

I wouldn't know much about choices as I'm just starting out. I wouldn't really classify MVC as dreadful to work with, I wouldn't exactly call it fun fun time either but hey my idea of fun is pure C,so...
Reply
#10
RE: MVC .NET Labelfor
(May 29, 2016 at 2:14 pm)pool the great Wrote:
(May 29, 2016 at 4:28 am)Marsellus Wallace Wrote: I've worked with MVC .NET abit way back, I don't remember much now Sad . my opinion that no one asked for: it fucking sucks, the whole thing is microsoft trying to puts it's giant corp. dick into the web developing,...........It simply lacks choices.

you can try Django, rubyonrails, lots of other things that will have good documentation, support, and good community. unless it's for a certain job you're for, then you're fucked.

I wouldn't know much about choices as I'm just starting out. I wouldn't really classify MVC as dreadful to work with, I wouldn't exactly call it fun fun time either but hey my idea of fun is pure C,so...

never said MVC is a bad design for web developing, MVC is everywhere now, Django, rubyonrails, PHP,..

I was talking about ASP.NET and microsoft being the dick of all time, treating it's users like slaves to it's own technology.
[Image: eUdzMRc.gif]
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  The devil argues for Net Neutrality Sterben 6 965 December 13, 2017 at 3:18 am
Last Post: Sterben
  Another Net Neutrality thread Sterben 7 787 December 8, 2017 at 9:02 am
Last Post: Edwardo Piet
  Thank god, I finished this MVC project finally ! WinterHold 6 1186 April 4, 2015 at 10:28 pm
Last Post: bennyboy
  .NET vs JAVA Marsellus Wallace 28 5649 March 30, 2015 at 4:25 pm
Last Post: bennyboy



Users browsing this thread: 1 Guest(s)