Posts: 5356
Threads: 178
Joined: June 28, 2015
Reputation:
35
MVC .NET Labelfor
May 26, 2016 at 10:25 pm
(This post was last modified: May 26, 2016 at 10:25 pm by ErGingerbreadMandude.)
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
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
46
RE: MVC .NET Labelfor
May 29, 2016 at 2:42 am
Sorry, I can't help. I've only worked with Windows Forms.
Posts: 5356
Threads: 178
Joined: June 28, 2015
Reputation:
35
RE: MVC .NET Labelfor
May 29, 2016 at 3:52 am
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
Posts: 2234
Threads: 89
Joined: February 20, 2014
Reputation:
33
RE: MVC .NET Labelfor
May 29, 2016 at 4:28 am
I've worked with MVC .NET abit way back, I don't remember much now . 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.
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
46
RE: MVC .NET Labelfor
May 29, 2016 at 7:19 am
(This post was last modified: May 29, 2016 at 7:41 am by bennyboy.)
--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.
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.
Posts: 30979
Threads: 204
Joined: July 19, 2011
Reputation:
141
RE: MVC .NET Labelfor
May 29, 2016 at 1:56 pm
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.
Posts: 5356
Threads: 178
Joined: June 28, 2015
Reputation:
35
RE: MVC .NET Labelfor
May 29, 2016 at 2:10 pm
(This post was last modified: May 29, 2016 at 2:14 pm by ErGingerbreadMandude.)
@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.
Posts: 5356
Threads: 178
Joined: June 28, 2015
Reputation:
35
RE: MVC .NET Labelfor
May 29, 2016 at 2:12 pm
(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.
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.
Posts: 5356
Threads: 178
Joined: June 28, 2015
Reputation:
35
RE: MVC .NET Labelfor
May 29, 2016 at 2:14 pm
(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 . 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...
Posts: 2234
Threads: 89
Joined: February 20, 2014
Reputation:
33
RE: MVC .NET Labelfor
May 30, 2016 at 9:22 am
(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 . 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.
|