Short solution for short problems

.Net: Ajax UpdatePanel causes DevExpress Controls to lose style after post

In my web application, I had a dev express gridview with a detail grid view. It was not so nice to see the form post backing after every click in the master grid, so I decided to use the ajax update panel.

The grid looks like this:

But after the first click the form looked like this:

The problem was apparently devexpress tries to edit the header of the page adding the style sheets links, so adding the runat="server" to your page header fixes this problem. In my case I had to add this to the master page and remove some <% tags in the header.

 <head runat="server">

iOS: Check if device is iPad or not

I have some screen that have different behaviour depending if its an iPad or not. Because iPad screen is a lot larger,  for iPhone I sometimes use a sub screen to lookup certain data, as for on the iPad I can keep it on screen. Not to easily check for iPad add these two lines to your class, or if used in different classes add it to your precompiled header file:


#define IPAD     UIUserInterfaceIdiomPad

Now you can check for iPad like this:

if (IDIOM == IPAD)








.Net WebAPI: add time zone suffix to datetime in JSON

On iOS, my JSON formatter needed to have the UTC format for date times. But My .Net WebAPI by default just formatted the date like this:


now just by adding these lines to the WebApiConfig.cs:

var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter;

json.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc;

the date times got the correct format:


.Net WebAPI: A potentially dangerous Request.Path value was detected from the client (:).

Ever got this error?

A potentially dangerous Request.Path value was detected from the client (:).

I was trying to give a datetime in the url as parameter to a REST service. but when I used data time, the following error occurred.


First I changed the route, making the date a querystring.


This worked fine, but then I would have to change to many routes. So finally the solution came up.

I could just remove the ':' as potentially dangerous sign. The can be done in the web.config of your project:

Change this line:

<httpRuntime targetFramework="4.5" />

into this:

<httpRuntime targetFramework="4.5" requestPathInvalidCharacters="&lt;,&gt;,*,%,&amp;,\,?" />

Now the time using the ':' will be passed to your web api.

Some functions have the datetime as first parameter, but have more following, like this:


So in this case it's nice that you can use the Route parameters for datetime.


public GalvaSFIMobileDataLayer.GP_MES_ShiftPlans GetPlanForDate(DateTime date, int shift)



            return PL.GetPlanForDate(date, shift);