Wednesday, 14 December 2011

How to Show a jQuery Dialog from Code behind

If you need to show a jQuery dialog from codebehind you can do so with the following code:

aspx:



js in aspx:

Note: dlg.parent().appendTo(jQuery('form:first')) is required so the dialog can be the same state after postback



code behind:

Basically we are adding a script to page load to create the dialog by calling our javascript method.

Thursday, 8 December 2011

Application pool crashes with The identity of application pool, 'your app pool' is invalid

I have had an issue with an application pool crashing with an error saying the identity of the application pool is invalid. After changing the username and password multiple times it became clear an incorrect password is not an issue.

The application pool was actually running as a local user on the web server. In order for a user account to be used in an application pool it needs to be added to a local security group (I have never done this before so its certainly not always the case).

To get it working be sure that the account is a member of the local security group "IIS_WPG", for membership in the IIS_WPG group is needed to run the w3wp.exe worker process.

Friday, 2 December 2011

Showing a modal dialog while page is updating

If you want to show a modal dialog while an update panel is updating it can be achieved with the following code:

Markup:


Javascript

Tuesday, 15 November 2011

Custom Resource File Considerations

1) Pages need a default resource file
2) Custom resource file is added after

Temporary asp.net files needs to be cleared

Monday, 7 November 2011

jQuery document.ready and update panels

If you want to use jQuery document.ready but have update panels on the page then the even is not fired on partial page refreshes.

In this case, another handler needs to be added so call the ready event at the end of every request.

The code below can be used to achieve this.

Thursday, 3 November 2011

Visual Studio Installer Project - Unable to build project output group 'Content Files from (Your website) (Active)'

Often when building MSI Windows Installers from ASP.NET Web Projects within Visual Studio.NET you'll get this error:

Unable to build project output group 'Content Files from SOMEWEB (Active)'

And you'll have no idea why this happened, no descriptive error message, nada.

Turns out that this is the MSI builder's way of telling you that it can't physically find a Content File that is referenced in the Project (CSPROJ, or VBPROJ).

The trick is turn on 'Show All Files' and open every folder until you find one with the Yellow Yield Icon. This subtle tip is telling you that this file doesn't exist on disk, but it does exist in the Project. Right-Click on it and Exclude From Project.

When the MSI Installer builder can't find a file marked as Content it fails

Friday, 14 October 2011

Referencing Control libraries in Web.Config - not each page

I have had an issue where there are different versions of assemblies loaded for the Microsoft report viewer. This was caused because the web config was referencing one version of the dll's and the pages were referencing another.

To fix this issue I removed all references to the report viewer assembly that were contained in aspx pages, and added an entry to the reportviewer dll to the web config so it can be accessed via the specified tag.

eg:

extracts from the web.config, here you can see the referenced ReportViewer assemblies, and where the controls are.



You can then use the report viewer controls in an asp page with the following: