Monthly Archives: February 2013

Chrome iPhone Mobile App and ASP.NET LinkButton PostBack Problem

LinkButton PostBack not working on Chrome Mobile?

Little note for Coinstar money transfer me and other mobile developers who may find this post. Here the fix.

ASPX file:

<asp:LinkButton ID="SendButton" runat="server" ClientIDMode="Static">Send</asp:LinkButton>

Code Behind file (.aspx.cs):

protected override void OnPreInit(EventArgs e)
	if (Request.UserAgent != null && (Request.UserAgent.IndexOf("AppleWebKit") > 0))  // added for compatibility issues with chrome 
		this.ClientTarget = "uplevel";


protected void Page_Load(object sender, EventArgs e)
	SendButton.Click += new EventHandler(SendButton_Click);

Jailbreak checklist ios 6.1 and 6.1.2

So you want to jailbreak your new or old iphone having iOS 6.1 or iOS 6.1.2? You are not sure what to do, because all guides explain how to jailbreak a new device, but not an already jailbroken iphone? Here a checklist of things to do before jailbreaking and what to do after jailbreaking to restore all your precious apps and tweaks.

Preparation – checklist for already jailbroken device

  • If you had install0us installed, and it doesn’t work anymore (after opening it it closes automatically) you can still open it, just go in airplane mode (iphone) or disable wifi (ipad). Make sure that the setting “sync itunes” is enabled. This will allow you to backup also your pirated apps in itunes. If you forget this option you may encounter problems such as itunes deleting your pirated apps during the sync or the backup.
  • In cydia, make sure the package “appsync” is installed, this allows you to backup via itunes, as explained above.
  • Do a backup of your SHSH Blobs with TinyUmbrella. Check this guide.
  • If you have pkgbackup or another program to backup your cydia apps, do a backup with that. If you skip this step you’ll have to manually re-install all your cydia tweaks. At least make a list of the most important ones.
  • Before doing a backup via itunes, right click on your device in itunes, and click on Transfer Purchases. This will save all your apps (including the pirated ones) in your itunes backup.
  • Do a full itunes backup.
  • If you have a passcode lock, disable it.

Preparation – Checklist for new or not yet jailbroken device

  • Do an itunes backup: connect your device to itunes, click on your device, click on “Back Up”.
  • If you have a passcode lock, disable it.

How to jailbreak – for new or not yet jailbroken device

Instructions to jailbreak + to restore your pirated apps (for already jailbroken device, upgrading to new iOS 6.1 or iOS 6.1.2)

  • If you have a passcode lock, disable it.
  • in itunes check for update and restore to 6.1.2 (important, upgrade to 6.1.2 via itunes and not on the iphone or ipad itself). I restore as new phone (empty = faster restore). Then later (after successfull jailbreak, I restore from the backup).
  • Jailbreak with the evasi0n tool.
  • Open Cydia, it will close after preparing some stuff. Re-open it, you may now install/upgrade just all the base cydia packages. Add the repository (in cydia: Manage > Sources) “”. Search for AppSync (AppSync for iOS 4.x-6.x). Install it. Close cydia, go to Safari, browse to and install vShare. Now you can download apps from vShare.
  • If you had a pkgbackup or alternative backup of your cydia apps, restore it.
  • You should also be able to restore your backup from itunes, including all your pirated apps. If not, in itunes go in the Apps section and add them manually again.

Hope this helps.

MVC Dropdownlist for enum

If you wanna display a dropdown list for an enumeration. ASP.NET MVC – Creating a DropDownList helper for enums is a great tutorial to achieve that.

However, if you wanna save in your DB the integer and not the text value, check Best method to store Enum in Database.

I had an enum similar to this:

public enum Sources
	Internet = 20,
	Space = 999

In my model class, I ended to use this code:

[HiddenInput(DisplayValue = false)]
public virtual int SourceId
		return (int)this.Source;
		Source = (Sources)value;
public Sources Source { get; set; }

Hope this helps.

Solution for jquery unobtrusive ajax live error

So you get an error from jquery.unobtrusive-ajax.min.js:

TypeError: $(…).live is not a function?

If you, like me, just upgraded in Visual Studio all NuGet packages included in your MVC project, you may probably encounter this error because the live() function is not available anymore in jquery 1.9, but still being called by .

The problem is that jquery.unobtrusive-ajax.min.js (jQuery Unobtrusive Ajax 2.0.20710.0 at the moment of writing) is calling the live() function in several places.

Here the solution: replace all occurrences of “live(” with “on(“, save and that’s it (source: stackoverflow)


jQuery Unobtrusive Ajax was upgraded and you can use the newest version with the latest jquery 1.x version.

Upgrading Umbraco 4.11.0 to 6.0.0

So you want an easy upgrade patch for version 4.11.x to version 6.0.0 (I just tested it from 4.11.1, but it should be ok also for 4.11, 4.11.2.x and 4.11.3.x)? You can follow the umbraco guide, download the new zip and overwrite the bin, umbraco, umbraco_client folders and merge the config files as explained, or prepare your own patch, or you can also use my patch here:

Please be careful: merge the config files and web.config with a tool like Winmerge. I use a commercial tool: Beyond Compare 3, which is one of my favorite programs and I can only recommend it, it costs only 30 USD. If you deploy many patches or you need a really good comparison tool, this is the one to use.

Check also: Official Umbraco 6.0.0 release on codeplex


Update 6.6.2013: If you want to get the newsest patches, check also my new post: Umbraco upgrade patches for umbraco 6.0.0 to 6.1.1

Multilanguage MVC4 or MVC5 website

So you want to create a multilingual project in MVC4 or MVC5? You are new to ASP.NET MVC and you are looking for a working solution, easy to understand and easy to implement? You are in the right place. This solution has been used for a couple of live websites and it worked quite well. Also the Frontend Developer that worked with me was quite happy with the solution. Read on to understand why.

You will find online a couple of tutorials and approaches. One I liked and followed is Creating a Bilingual ASP.NET MVC 3 Application – Part 2: it offers a working culture detection based on the user browser’s settings and it allows the user to browse the site also by entering in the url -just after the domain name- the language abbreviation (like this: ). The solution in the above tutorial allows the developer to save the translations in .resx files (same principle for LocalResources and GlobalResources).

However, the Cultural View Engine for MVC tutorial (or better: Custom View Engine for Localized Views with ASP.NET MVC Razor – for razor cshtml pages) offers the same browsing routes and the possibility to save the translations directly in the view files, making the editing much more user friendly than editing the .resx files in Visual Studio (which, for long and formatted texts, is not user friendly at all).

When I studied these 2 approaches/tutorials, I decided to mix them, making the developer life much easier and flexible.

Imagine the following scenario:

  • Global.resx file for all the common translations for classic UI labels, buttons, tooltips etc.
  • a default ~/Views folder containing the main views and partial views (e.g. Index.cshtml, About.cshtml, _Header.cshtml, _Footer.cshtml) with localized content taken from the .resx files, like this @Global.FooterText
  • some views containing the content not as variable like @Global.FooterText but copied and pasted there directly e.g. “Copyright Foo Bar 2013”, saved e.g. in Example.cshtml
  • the same views as above, with the same name as above and a language suffix e.g. and content translated directly in that file (in this example, “de” is for German)


My solution


  • (use this as reference only. Create your own project in Visual Studio 2013 in MVC5 to have all the updated packages and dependencies, bootstrap etc.)
  • Update 2016-05-13 I didn’t check it but you may have a look at Xavier educa02 on github (repository based on this work)

Note: in the Areas you can’t have a controller with the same name of a standard controller (or vice-versa). Every controller must have a unique name.

You may find these 2 helpers quite handy (I use GetLanguage in my controllers when I need to process contents based on the language, in example to build an URL I have to insert in a mail sent to the user, or similar things):

  • CultureManager.GetLanguage()
  • CultureManager.GetCulture()

To use/implement this solution in your own project in your solution you need about 5 Minutes (+ a few more minutes to add new languages or remove the ones you do not want to support). Just follow this simple procedure:

  • copy all the files you find under “Code” and put them in a separate class library (and add a reference to it), or copy the “Code” folder directly in your project.
  • Check the modifications to the global.asax.cs file and apply them to your global.asax.cs file (and update your default route in case it’s not Home/Index).
  • If you want more languages or remove some from the default ones I added (en, de, fr, it) you must edit the CultureManager.cs file. Check the constants at the top and the method InitializeSupportedCultures(). If you need more precision in the culture (in my case I use only the 2 letters ISO abbreviation) you may do some refactoring.


My solution is based on these 2 tutorials:

I downloaded and updated the first tutorial solution and added the LocalizedViewEngine.cs from the 2nd tutorial. Then updated the global.asax.cs file accordingly.

As some people asked for it, I added also an example with Areas. If you don’t need areas, simply delete the “Areas” folder, save all and re-compile.



Update 2015-02-19
Seems that this blog post is still helpful. Good news, this solution works of course also with MVC5. Don’t update my demo project to MVC5, start a fresh one and follow the procedure to add multi-language views support.

Update 2013-10-21
Added some more useful information on how to use this solution. Hopefully it should be quite easy to implement this in your solution.

Update 2013-10-07
As some people asked for it, I added an example with Areas. I added an Area called “Admin”, a controller called “Account” and 2 test Views: Index and Test. I added a localized and for Test I used the .resx resources. To register the new area and make it work with my multi language support, see Areas\Admin\AdminAreaRegistration.cs. Hope this helps.

Update 2013-06-05
I’m not 100% about this, but my solution can lead to caching problems.

Symptom: after changing the language to xx I keep seeing the contents of my main View PageFoo.cshtml and not the contents in PageFoo.xx.cshtml.

Solution: I needed -for my production website- to keep the debug option in the web.config file, more precisely in the tranform in Visual Studio I had to keep this (as I use the publish function):

<compilation xdt:Transform="RemoveAttributes(debug)" />

If you don’t have a transform file, then the option in the web.config file has to be:

<compilation debug="true" targetFramework="4.0" />