Beyond the boundaries of ASP.Net development

RDLC in Visual Studio 2010 WebApplication using ObjectDatasource 

Wednesday, February 26, 2014 6:20:25 AM

Issue: VS 2010 allowed only to add SQL DataSource to my local RDLC in a WebApp - but I wanted to use my existing Object DataSource.
The only way I found was creating a temporary non-web project in the same solution and create the RDLC there. When I went to add a dataset, it shows "Objects" as an option. You have to add a reference to your web project so that your objects are visible, but then you can pick the one you want and use that in the RDLC. After that, you can just drag-drop the RDLC file into your web project, delete the temp project, and you're good to go. Just remember that you have to add the datasources manually in code, and they have to be named the same as you specified in the RDLC.

Absolute URLs in Web.siteMap 

Tuesday, January 21, 2014 10:21:30 AM

I just encountered an issue with Absolute URLs in Web.siteMap. They didn't show in the menu structure.

Reason: We had securit trimming enabled and the node with the absoulte url was inside a secured SiteMapNode. Since the external URL does not have a web.config to check current user's permissions the respective sitemap node was simply dropped.

Solution: Add a roles="*" to the node and the security trimming for that node will be skipped since everybody is allowed to access the node. Voilá:


<siteMapNode url="~/Administration/default.aspx" title="Administration" roles="Administrator" >
    <siteMapNode url="~/Administration/" title="Reports">
        <siteMapNode url="~/Administration/ReviseCountryNote.aspx" />
        <siteMapNode url="" title="Activites" roles="*" />

ASP.Net Profile error "Value cannot be null. Parameter name: type" 

Sunday, December 08, 2013 5:18:15 PM

The ASP.NEt Profile error "Value cannot be null. Parameter name: type" might be caused by Web Deployment project  or simply by a missing dll reference. In my case the AjaxControlToolkit.dll was missing on the target web server which caused the following error whenever the site tried to access the Page.Profile

[ArgumentNullException: Value cannot be null.
Parameter name: type]
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +10670694
   System.Activator.CreateInstance(Type type) +6
   System.Web.Profile.ProfileBase.CreateMyInstance(String username, Boolean isAuthenticated) +77
   System.Web.Profile.ProfileBase.Create(String username, Boolean isAuthenticated) +256
   System.Web.HttpContext.get_Profile() +113

RegisterForEventValidation can only be called during Render() 

Thursday, November 07, 2013 11:26:31 AM

When exporting rendered Controls within the Page_PreRender of an aspx page e.g. as Excel mime, I ran across the Exception

RegisterForEventValidation can only be called during Render()

which can easily be overcome setting the EnableEventValidation="false" in the "<%Page" directive like this:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Records.aspx.cs" Inherits="Records"
MasterPageFile="~/Master.master" EnableEventValidation="false" %>
and override VerifyRenderingInServerForm by adding following method in your C# code behind
public override void VerifyRenderingInServerForm(Control control)
    /* Confirms that an HtmlForm control is rendered for the specified ASP.NET
       server control at run time. */

Maximum character length Validation 

Thursday, September 12, 2013 7:40:01 AM


Maximum character length Validation (Maximum 8 characters allowed)
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "TextBox1" ID="RegularExpressionValidator1" ValidationExpression = "^[\s\S]{0,8}$" runat="server" ErrorMessage="Maximum 8 characters allowed."></asp:RegularExpressionValidator>
Minimum character length Validation (Minimum 8 characters required)
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "TextBox2" ID="RegularExpressionValidator2" ValidationExpression = "^[\s\S]{8,}$" runat="server" ErrorMessage="Minimum 8 characters required."></asp:RegularExpressionValidator>

Ad hoc update to system catalogs is not supported. 

Thursday, April 18, 2013 2:11:27 AM

You need to

EXEC sp_configure 'allow updates', 0
if you encounter a Ad hoc update to system catalogs is not supported message while doing something like this on SQL Server (2012 in my case)

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
-- To update the currently configured value for advanced options.
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
-- To update the currently configured value for this feature.


about SQL Server alias and ASP.Net 4.0 on x64 

Thursday, April 18, 2013 1:23:42 AM

I had to upgrade an old ASP.Net 2.0 application to run on IIS 7.5 and SQL Server 2012 (x64). The DEV environment is using SQL Aliases to connect to the same SQL Server using different names. So far only the 32Bit Aliases were set and sufficed when working with .Net 2.0. But when using ASP.Net 4.0 the web application could not connect to the SQL Server alias anymore throwing:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connection.
Because ASP.Net 4.0 uses 64Bit SQL connectors, I had to copy the SQL Server aliases to the 64 Bit section as well:

Applying for UN positions as a contractor 

Tuesday, March 26, 2013 3:55:00 AM

As there are hundreds of applicants for any publicly posted UN vacancy, the aplication process usually involves serious screening of the P11 and motivation letter (where applicable) for relevant work experience. Here it is important to respond to all requirements layed out in the vacancy as in this stage no other resources will be consulted. Even is you'd be the best fit for a position, little goof-ups can cost you the short list.

  • Use the same wording and respond to every requirement.
  • Don't refer to external resources like your web page.

When it comes to the interview the usually ask some random detailed technical questions to check your background. Being prepared means having:

  • a goood reason why you are applying for the job. Always expect that question and respond with you unique selling points in relation to the job.
  • prioritization strategies to respond to questions regarding stress, meeting deadlines, prioritization and mitigation.
  • sometimes they ask how to mitigate conflicts of interest among your collegues of superiors. Be prepared for that as well.

If they finally offer you the job, keep in mind that they usually issua ICAs to save money. Even in situations where imho a TA would fit the vacancy, it's normally cheaper and less admin overhead for the UN. But don't fall for their first offer! The either have a fixed budged and or room for negotiation when it comes to salary and wage rates as show in the guidelines for individual contracts:

Junior Specialist (like P2) 200-300 US$
Specialist (like P3) 300-550 US$
Senior Specialist (like P4+) 550-1000 US$

550 US$ a day? Sound good eh? To be honest, for an european professional self employed contractor with 12+ years relevant work experience, being paid less than ~500 US$ before tax for short term consultancies is not the world...And here is why:

  • ICAs don't entitle the contractor to annual leave or sick leave.
  • Short term consultancies don't offer any kind of job security - it might take months to be selected for annother UN contract, especially in the IT sector where I am working...So you'd better budget for for regular dry spells between contracts.
  • You have to provide your own equipment (hardware, software licenes, internet, communications, etc)
  • Being not considered staff to the UN, you have to deduct up to 50% income tax on top of about 25% social security premium in Austria.

Don't get me wrong, working as a contractor for the UN is definitly appealing when it comes to diversity, responsibility and globalization. Love it hate it or leave it.




Report Designer .rdlc pie chart data labels for multiple data fields 

Tuesday, March 19, 2013 11:05:14 AM

The problem: A .rdlc (VS 2010) rendered in local mode with a pie chart being fed by several data fields (top box). Right clicking and using #Percent as suggested here rendered only the first data field data label on the first pie chart slice like this:

In order to get all percentage values I had to reorder each data field to be the first item and perform this right clickinging and using #Percent game for every data field being at first position. The red arrow should give a hint of what I mean:

After that, the report looked fine and all pie chart slices showed their percentage like supposed:

The end :-)

List of SharePoint RegistrationID 

Friday, February 15, 2013 5:26:03 AM

InvalidType = -1
GenericList = 100
DocumentLibrary = 101
Survey = 102
Links = 103
Announcements = 104
Contacts = 105
Events = 106
Tasks = 107
DiscussionBoard = 108
PictureLibrary = 109
DataSources = 110
WebTemplateCatalog = 111
UserInformation = 112
WebPartCatalog = 113
ListTemplateCatalog = 114
XMLForm = 115
MasterPageCatalog = 116
NoCodeWorkflows = 117
WorkflowProcess = 118
WebPageLibrary = 119
CustomGrid = 120
DataConnectionLibrary = 130
WorkflowHistory = 140
GanttTasks = 150
Meetings = 200
Agenda = 201
MeetingUser = 202
Decision = 204
MeetingObjective = 207
TextBox = 210
ThingsToBring = 211
HomePageLibrary = 212
Posts = 301
Comments = 302
Categories = 303
Pages = 850 (thanks to Anders Jacobsen for this one)
IssueTracking = 1100
AdminTasks = 1200

Site Map | Printable View | Design by creative & it consulting | © 2009 - 2017 Florian Morrenth