You might have been mislead when using DropDownListFor method when you wanted to set the selected item or it is just me. I thought you can use the SelectList function fourth parameter to set the selected value, as it says in the documentation but this does not work because data is binded to the data object.
If the object or property in the model is empty and it used as an int then it will default to zero, so the item with the value zero will be selected.
So naturally all you need to do is set the property in the model to the value you want and it will select the correct default value in the list.
Example below:
@{
//set the username to be selected
Model.Post.UserId = Model.GetUserId;
}
//Outputs a list of userid
@Html.DropDownListFor(model => model.Post.UserId, new SelectList(Model.Users, "Id", "Name"))
Sounds so simple and straight forward now, but is amazing how something small can distract you from the obvious answer sometimes.
SOPA will break the internet! It really is not the solution to stop pirated content from being distributed around the internet. The entertainment industry do have plenty laws that can stop access to illegal content. SOPA will most certainly create more issues than fix any. The freedom and innovation that the internet gives us will be taken away, severely restricting our online progress. Read more »
If you have recently upgraded to the new iOS 5 and opted to use the iCloud you might have noticed that you can no longer add or edit your contacts. If you are one of these people the fix is quite simple but some what annoying.
The fix
Go to Settings -> iCloud and turn on Contacts. It will merge with iCloud.
You should be able to go back to your contact list and see the add and edit button are back.
If it works you can turn if off and you will still have the add and edit button.
This might be a bug but its a very strange one. Why do you need to sync your contacts with the iCloud to get the add and edit contact buttons back? After turning it on and then off again why do the buttons stay?
Getting ready for the new Call of Duty Modern Warfare 3 game, I certainly am and I have a feeling its going to be epic. It definitely looks like an improvement on MW2 and a good ones. This is one of the biggest games to be released this year. I have pre-ordered my copy but it can’t come soon enough. I have put some videos of the new game below to tickle those gaming juices.
What is happening? We are moving through each item in the array and converting it into a string. They will all be in a string format and it is then assigned to the string array. The same is done below except it is from a string to an int array. This can be applied to most other array types.
The content attribute in CSS is pretty useful. It can only be used with the Pseudo properties before and after which essentially determine where the content is going to be outputted.
So a basic example using the content attribute would be to label small items: 09839 048882
.phonenumber:before{ content: 'Phone number: ';}
Essentially this snippet will add “Phone number” in every element that uses this class at the beginning of the text. Pretty useful when there is a mass change of labels needed to be done.
How to make a tool tip just using CSS? Read more »
After installing the latest firmware version 3.70 for the PlayStation 3 I noticed that the TV option had disappeared. How the hell did that happen?! This of course means that I could not access the BBC iPlayer via the icon, not like it was an issue just annoying, since it was basically loading it in the browser. I don’t know if anyone has tried using the new version of the BBC iPlayer in the PlayStation browser, it kind of doesn’t work. You can navigate using the D-Pad but you can’t actually click through to the actual video item. The essential bit! Then I thought I will just search for the item using Google, found the TV series clicked on it and was faced with a loading screen that did not load anything! I gave it two minutes more that enough time. Great can’t access that actual videos directly, this is unbelievably frustrating, I was about to explode!
Solving the issue
I would not call this an actual solution to the problem but it does bring back the TV option in the PlayStation navigation which you can then install the iPlayer application. All you need to do is log into vidzone come back out of it and for some magical reason its back. WOW! Some sort of bug somewhere in the software. If you don’t have vidzone installed all you need to do is sign into the PlayStation Store, scroll all the way down the menu where you reach “Other Media”, select it and download the free application. Hopefully this will bring back the TV section and you can install the new BBC iPlayer Application.
The new BBC iPlayer App for the PS3 is way better than the previous version.It’s natural to navigate using the D-Pad and fairly quick to load, but it sometimes lags behind if you scroll through fast. Overall a major improvement once you figure out how to install the app, which I can’t help but think that PlayStation messed up.