.Net Development & General Tech Related News

ASP.NET MVC – Passing ViewData to a MasterPage

January 12th, 2010 Posted in .Net, ASP.NET MVC, ASP.Net, C# | No Comments »

If like me you are using ASP.NET MVC for some of your web applications these days and use MasterPages within them, then you may have come accross the need to pass ViewData to the MasterPage.  For example, this might be for a dynamically generated navigation bar.

When I first started using MVC, I simply passed the ViewData required for the MasterPage along with every action, but even with a small site, this was a lot of code replication.

To solve this problem, we can create an ApplicationController class which inherits from the Controller class we all know and love.  Your applications’ controllers then in turn simply inherit from this new ApplicationController.

Below is a simple example of an ApplicationController.

namespace MvcSite.Controllers
{
    public abstract class ApplicationController : Controller
    {
        private MyEntities _dataContext = new MyEntities();

        public MyEntities DataContext
        {
            get { return _dataContext; }
        }

        public ApplicationController()
        {
            ViewData["categories"] = DataContext.Categories.ToList();
        }

    }
}

Hope this helps someone else as well. Certainly removed a headache for me!

Share this Post:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DotNetKicks
  • Reddit
  • StumbleUpon
  • TwitThis

Tags:

3 mobile broadband not working (“No Network”) on Windows 7…

October 26th, 2009 Posted in Windows 7 | 3 Comments »

Well, we moved into our new house this weekend….so I am pretty tired.  I cannot believe how much stuff we have managed to accumulate over a relatively short period of time!  So, now we are living in our very own building site. :)   The front room is currently made up of some scaffolding, two garden chairs and a TV (with Sky HD which got installed this morning…..got to get the priorities right people).

Because of the move, I currently dont have a landline and consequently, there is no broadband! I didn’t this that this would be a problem because I have borrowed a mobile broadband USB dongle from 3……not a problem that is until I plugged it in! 

Once I had plugged in the USB modem and installed the software, I simply got the message “No Network”, but the light on the device was green??  After several more tries of re-installing the device drivers and a few more ideas I decided to visit a friend a use their wi-fi to look for a solution. 

Turns out that if you want to use your 3mobile broadband device on windows 7, you need to download drivers BEFORE you upgrade!  Alternativly, if you are like me and are on Windows 7 already, you too can find a friend with an internet connection and download the updated Windows 7 Only drivers from Three here.

Share this Post:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DotNetKicks
  • Reddit
  • StumbleUpon
  • TwitThis

Tags: , , ,

Visual Studio 2010 and .Net 4.0 Beta 2 Download Available

October 20th, 2009 Posted in .Net, ASP.NET MVC, ASP.Net, Betas, C#, Entity Framework, Silverlight, microsoft, msdn, visual studio | 1 Comment »

Visual Studio 2010 and .Net 4.0 Beta 2 has now been released to members of MSDN, with a public download available from Wednesday.

Beta 2 brings many improvements to the table, including improvements in Sharepoint, WPF, ASP.NET, WinForms, as well as improvements to the core IDE and testing tools. I saw some of these IDE improvements at an event with Scott Gu in Manchester a couple of weeks ago and they look pretty cool.

Visual Studio now comes in several flavours, namely Premium, Professional and Ultimate and the good news is that TFS 2010 comes out of the box with all three.  Apparently it only takes 20 minutes to setup source control, bug and issue tracking and automated build with it.

Finally, another great piece of news is that this release also ships with a Go-live license, so this can be used for production projects if you wish :)

If you are a member of MSDN and want to download the beta now, you can get it from here.

For more information on the release visit Scott Gu’s blog where you he has started a series of posts on the new features in 2010 Beta 2.

Have any of you been using Beta 1? Will you be using Beta 2? What do you think of the way 2010 and .Net 4.0 are shaping up?

Share this Post:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DotNetKicks
  • Reddit
  • StumbleUpon
  • TwitThis

Tags: , , ,

Silverlight Coming to Mobile

September 25th, 2009 Posted in .Net, Silverlight, Windows Mobile | 1 Comment »

Ok, so this is not exactly a surprise to many people, but as posted on the Expression team blog, the Silverlight team have announced that Silverlight will be integrated into Windows Mobile 7, the reboot of the mobile OS from Microsoft.

According to the Silverlight team, they are totally commited to having Silverlight work on all mediums, from desktop PCs, TVs and mobile devices.

This comes at a time when Flash is likely to appear on more and more mobile devices soon, but with the success of Flash Lite…well…not really being a success, it remains to be seen how well the next wave of Flash mobile will be accepted.  It certainly looks like Silverlight might have the upper hand here if things continue as they are.

There has been talk about Silverlight coming to the mobile platform for some time, with a lot of people for a while, myself included, expecting it to arrive in time for Windows Mobile 6.5, which is due for release in around a month.  However, 6.5 is only an interrim release until the complete overhaul that is Windows Mobile 7 is released.

So, are you excited about seeing Silverlight on mobile devices? do you think it will be a good thing or a bad thing? or could you not care less?

Share this Post:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DotNetKicks
  • Reddit
  • StumbleUpon
  • TwitThis

Tags: , ,

Scott Guthrie – Manchester – September 2009 – ASP.Net 4.0, MVC, Silverlight 3, VS 2010

September 16th, 2009 Posted in .Net, ASP.NET MVC, ASP.Net, Silverlight, microsoft | 2 Comments »

scottguthrie

Scott Guthrie, Microsoft’s Corporate Vice Presedent and all round .Net Guru is coming to Manchester, UK, later this month to talk about what’s new with Visual Studio 2010, ASP.Net 4.0, Silverlight 3 and upcoming improvements to the MVC Framework!

Seating for this event, entitled Guathon 2009,  is very limited and as such you can only join the wait list at the moment, but I have been lucky enough to secure a place at what promises to be a fantastic workshop.

The announcement on the event home page over at DeveloperDeveloperDeveloper also has a funny section of “things you might not know about Scott Gu”, such as;

  • When Scott Guthrie throws exceptions, it’s across the room.
  • All arrays Scott Guthrie declares are of infinite size, because Scott Guthrie knows no bounds.
  • Scott Guthrie doesn’t have disk latency because the hard drive knows to hurry the hell up.
  • Scott Guthrie writes code that optimizes itself.
  • Scott Guthrie can’t test for equality because he has no equal.
  • Scott Guthrie doesn’t need garbage collection because he doesn’t call .Dispose(), he calls .DropKick().
  • For the rest of this amusing list and more info on the event or to add yourself to the wait list, visit the event home page.

    Share this Post:
    • Digg
    • Sphinn
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • DotNetKicks
    • Reddit
    • StumbleUpon
    • TwitThis

    Tags: , , , , ,

    Resharper for Visual Studio 2010 Available!

    September 16th, 2009 Posted in .Net, Betas, visual studio | No Comments »

    resharper
    Ok, this one completely slipped by me! A while back I told you that JetBrains had a page on their web site stating that a preview of ReSharper for Visual Studio 2010 was on its way and that we would see it in June….but there was nothing.  Turns out it has been there since July in the form of Nightly Builds available for download, there was just no major announcement made.

    Anyway, if you want to get your hands on it you can download it from here .  To install it just make sure the extension is .Vsix, IE seems to download and save this as a zip so you may need to rename it, and the Visual Studio 2010 extension manager will take over from here and take you through the short installation.

    Once it is installed, open Visual Studio, where you will need to enter the licence information provided on the download page.  It is telling me that it is going to expire on the 22nd September at the moment, but this may be extended further until VS 2010 beta 2 is released later in the year.

    Anyway, as you can see, I now have mine ready to rock and roll so enjoy!

    Share this Post:
    • Digg
    • Sphinn
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • DotNetKicks
    • Reddit
    • StumbleUpon
    • TwitThis

    Tags: ,

    Outlook 2010 Features & Screenshots

    September 15th, 2009 Posted in Betas, Office, microsoft | No Comments »

    I have been using Outlook 2010 now since the start of the technical preview, which I was lucky enough to manage to be a part of, and I love it! So, for those of you not currently able to try this baby out, I thought I would share a few of the new bits of Outlook that I really like and I am finding useful.

    Firstly, here is a full screen shot of the new Outlook 2010 interface.  I suppose I must state that this is only a technical preview and this may still change a lot before the final version is released.

    looks_and_feel

     

    The Ribbon

    As you can see from the screenshot above, the biggest change to the Outlook interface is the introduction of the infamous Ribbon, with four main tabs. Lets look at these tabs in a bit more details and see what they bring us;

    Home - This contains many of the standard buttons you are used to seeing at the top of an outlook window, such as “New Mail”, “Reply”, “Forward” and a plethora of options relating to email rules and categorising your items.

    home

    Send / Receive – As you would expect, this tab contains……the send and receive button! :)   Along with some of the more commonly used items, such as buttons for marking items for download or triggering the download of headers only.

    send_receive

    Folder – From here you can control your mail archiving, mark items as read, create and modify your folders and run your mail rules.

    folder

    View – This is one of my most used tabs.  Here you can set different views for each of your folders.  The most notable introduction here is the “Conversation” view, which will attempt to group your mail into conversations.  This is not for everyone and certainly not for every folder (I switched it on in a folder to receive Facebook messages and it created one huge conversation as all the subjects were the same), but I like it in the right circumstance.

    view

     

    Contact Actions

    One feature I really do like in Outlook 2010 is the new contact action popups.  If you hover over a name in the from or to fields on an email, you now get a popup giving you several actions you can perform on this person, such as adding them to your Outlook contacts, scheduling a meeting, viewing their stored contact information if they are already in your contacts, sending an instant message or even starting a telephone call.

    contact_actions

     

    Quick Steps

    Quick Steps are a set of very useful buttons on the Home tab. They include ways of replying to a team of people or your manager, both of which are customised tasks to suit you.  There are a standard set of buttons here and you can also create custom quick steps to suit yourself. Very nice!

    quick_steps

     

    Quick Bar

    Ok, here is something I didn’t even notice until a couple of days ago, the Quick Bar.  Until recently, every time I wanted to send and receive my email I have been switching to the Send / Receive tab and click the S & R button.  This was ok, but got a bit annoying having to switch tabs every time, as most of the time I use the Home tab for functions like “Reply” etc.  Then I noticed the Quick Bar.  This handy little addition allows for a constant set of buttons that are displayed either above of below the ribbon (your choice) and by default contains a send and receive button with more being added as you see fit.  This is a nice feature, but it is quite small, so that’s why I didn’t notice it for so long!!!

    quick_bar

     

    The “Office” Button

    The “Office” button sits in the top left hand corner of every Office 2010 application. When clicked, this button allows access to all the features you would normally have seen under the standard menus (file, edit, tools, etc) in Outlook 2007.  You can see Microsoft have spent a long time designing this feature and it works well.  As you can see from the screen shot below, there is plenty of room for each task, much more space for explanations and it just ‘feels’ like a better way of doing things to me.

    start_button

     

    The Windows 7 Task Bar Context Menu

    Ok, so you have probably seen this before, but I thought it was worth a mention anyway.  Outlook 2010 now gets it’s own context menu on the Task Bar in Windows 7, which gives a very nice shortcut to common tasks.

    context_menu_start_bar

     

    Verdict To Date

    So far I have found the improvements made in this latest incarnation of Outlook to be very useful and have increased my productivity, which is always good, especially with an integral everyday task such as email management.  But, of course, please feel free to disagree with me as this is just my opinion after all!

    Share this Post:
    • Digg
    • Sphinn
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • DotNetKicks
    • Reddit
    • StumbleUpon
    • TwitThis

    Tags: , , ,

    SOLVED: Visual Studio 2010 Beta 1 – Cannot Create The Window

    September 14th, 2009 Posted in microsoft, visual studio | 8 Comments »

    I am currently in the Microsoft Office 2010 tech preview and I must say that I am loving it! :)  

    What I did not love though was after installing Office 2010, my Visual Studio 2010 Beta stopped working, simply displaying the message “Cannot Create The Window”.

    Microsoft claimed not to be able to recreate the issue and I was quite happy to wait until another version of VS 2010 was released, but luckily for me, Microsoft have now found the issue.  Apparently, there is a version msvcm100.dll in C:\windows\system32 which is different in office 2010 than in vs 2010.  It also seems that office and vs play nice when using the VS version of the dll, but that VS falls over when using the office version.

    Ok, so to the workaround……

    You have two options;

    1. Replace the msvcm100.dll with this one, msvcm100.zip, I took from my system32 folder. 

    or

    2. If you would prefer not to use a randomly downloaded dll from here, you can rename the msvcm100.dll in system32 to msvcm100.dll.old and then run VS 2010 setup and choose to repair.  This will recreate the dll.

    The working version of msvcm100.dll has a datetime stamp of 6th May 2009 7:20AM.

    Well, now my Visual Studio is working again, I am off to have a play!

    Enjoy!

    Share this Post:
    • Digg
    • Sphinn
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • DotNetKicks
    • Reddit
    • StumbleUpon
    • TwitThis

    Tags: , ,

    IE8 – Intermittant “Internet Explorer Cannot Display The Web Page”

    September 5th, 2009 Posted in Internet Explorer | 2 Comments »

    For the last couple of weeks I have been experiencing this frustrating message, “Internet Explorer Cannot Display The web Page”, nearly everywhere I have been visiting.  Also, it seemed like the more I visited a web site, the more it would display this message!

    Anyway, I reached the end of my tether last night and decided to try and find the cause.  After some digging around it appeared that some people had found the Google toolbar to be the cause.  So I uninstalled the toolbar…….and sure enough, the problem stopped!

    Anyway, just wanted to post this in case anybody else was having the same problem.

    Share this Post:
    • Digg
    • Sphinn
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • DotNetKicks
    • Reddit
    • StumbleUpon
    • TwitThis

    Tags:

    Entity Framework v2 Articles

    August 25th, 2009 Posted in .Net, Entity Framework, ado.net, microsoft, msdn, visual studio | No Comments »

    There has been a lot of information being passed around recently about the changes being introduced in the second major release of Microsoft’s Entity Framework, so I thought it might be a good idea to get a list of articles together on the subject that I have found useful.

    If you know of any more good articles you have found yourself, let me know!

    Enjoy!

    The ADO.Net Entity Framework (2010) (MSDN) – If you don’t know or are unsure of what the Entity Framework is, then this might be a good place to start.  It provides a good overview with links to more articles going into details in specific areas.

    Visit Site

    What’s New In Entity Framework 4 (Slides) – For those of you who are familiar with the first version of the Entity Framework in .Net 3.5 SP1, but have not yet delved into the next release, these slides give an overview of what has changed and what has been introduced.

    Visit Site

    TUTORIAL: Model First using Entity Framework 4 and Visual Studio 2010 – This is a tutorial I wrote a while back for those with the Visual Studio 2010 beta who wanted to see the new model first functionality introduced in EF v2.

    Visit Site

    Entity Framework v2 and Data Access Architecture Best Practices – Some design patterns and development style discussion for when using the EF v2 and Visual Studio 2010.

    Visit Site

    N-Tier Application Patterns with Entity Framework v2 – A good article regarding designing N-Tier applications with EF v2, using .Net Framework 4, Visual Studio 2010 and WCF.

    Visit Site

    Multiple Database Support in Entity Framework 4 – Interesting article discussing the database independence being introduced with the Entity Framework.

    Visit Site
    BOOK: Professional ADO.Net 3.5 With LINQ and the Entity Framework - I am currently reading this book which tackles ADO.Net 3.5 with the Entity Framework.  Whilst this is not specifically for version 2, this seems to be a good into the the EF and worth a look if you are new to the subject.

    Visit Site

    Share this Post:
    • Digg
    • Sphinn
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • DotNetKicks
    • Reddit
    • StumbleUpon
    • TwitThis

    Tags: , , ,