MVC–Day 2(or 3/4ish, maybe more)

So, my excursion in the web world continues… One of the issues I have coming from silverlight / wpf is that I’m very used to the XAML, MVVM approach to developing, I can knock up a passable interface in XAML in very little time (note, I didn’t say a good interface), but I really don’t know how to do this in CSS..

OK, not totally true, I have a rough guess, I have played with things like Firebug, and modified existing css in the past, but the problem with that, is that I’m just tinkering.

With this site, I want to learn CSS properly, from scratch, I will use the existing site.css (which is now renamed to SitOrige.css due to a ‘touchpad’ fat thumb incident in my rename attempt) to see how some things are done, but as it stands my site is now the plain html that (I presume) a screen reader should see, and I intend to get to grips with the looks soon.

Of course having done that I’m now painfully aware that without content, style is a bit pointless, sooo, on with content… I currently have 6 Controllers, (including the default Account and Home controller) the other four at present representing four of the entities I have. I don’t know if this is right, at the moment it seems like a bit of overkill, but that could be because I’ve implemented the Add/Edit/Delete bit in each controller, I guess with time I will strip those down to bare bones, buuut for now it’ll do.

I’m pretty happy (although I realise this is noddy stuff) that my links are working and I’ve actually done some Razor code hooking my entities together, and the ease of this has been very unexpected. The biggest issue I’ve had so far was when I was attempting to jump from one controller to another, I was naively using:

@Html.ActionLink(item.Name, "Details", "Controller2", new {item.Id})

When I should have been using:

@Html.ActionLink(item.Name, "Details", "Controller2", new {item.Id}, null)

That took a bit of stack overflowing to work out..

My plan forward is to try to add a bit of interactivity, I have some ‘auto-generation’ code to add some stuff into the site which I’d like to get running, at present it’s in a console app and appears to be working ok, so fingers crossed it won’t prove to be too onerous.

Print | posted @ Thursday, October 13, 2011 6:46 AM

Comments on this entry:

Gravatar # re: MVC–Day 2(or 3/4ish, maybe more)
by Matthew Abbott at 10/18/2011 1:00 AM

I'm confused as to why you needed that last "null" value, when that value is for the htmlAttributes argument, which isn't required...? What *was* it doing before you did that?
Gravatar # re: MVC–Day 2(or 3/4ish, maybe more)
by Chris at 10/18/2011 1:28 AM

It wouldn't take me to the other controller, it would just goto a URL similar to (and this is from memory, so could be wrong)

Gravatar # re: MVC–Day 2(or 3/4ish, maybe more)
by Chris at 10/18/2011 1:30 AM

Similar to this:
Gravatar # re: MVC–Day 2(or 3/4ish, maybe more)
by Matthew Abbott at 10/18/2011 1:42 AM


So the compiler was linking that method call to an overloaded method you weren't expecting? That makes sense, there is no overload that accepts ActionLink(HtmlHelper, string, string, string, object).
Post A Comment