Thursday 26 May 2011

Application Pool stops when started

If you are using a custom identity for and application pool and get either of the following errors:

A failure was encountered while launching the process serving application pool 'WAP'. The application pool has been disabled.


or

The identity of application pool 'WAP' is invalid, so the World Wide Web Publishing Service can not create a worker process to serve the application pool. Therefore, the application pool has been disabled.


then you may need to grant some permissions to the account you are using.

Here is a list of things to try

  • Add user to IIS_WPG group
  • Add user to local admin group and adding the "Act as part of the os" right.
  • run aspnet_regiis -ga "domain\user" on the user account you are using
  • Check password
  • Grant the Log on as service role in local / group policy

Friday 20 May 2011

Loading a Drop down List in Row Created

If you need to populate a drop down list in a Grid View row created event you may find that the items in the list are appearing twice.

I found this problem is caused if you call databind on the drop down list from within the Row Created event of the grid view. It looks as though the drop down list is automatically calling DataBind when the gridview calls the Row Databound event.

Removing the call to databind from the row created event fixed the issue.

eg:

Thursday 19 May 2011

Style textboxes with css

I have recently had an issue with applying a css class to a text box as it was continually being ignored.

After about 2 hours of searching I found out it was being overridden because a skin file was changing the css class.

Long story short, If you want to apply custom classes to the same type of control, don't use a skin file. I removed the skin file, never to be used again, and replaced with the following css:

Monday 9 May 2011

Ajax Controls Toolkit: ModalPopup extender with UpdatePanel

Scenario: show popup (preferably modal) with editable fields in a Master-Detail mode and provide ability to accept or reject update.

Straightforward combination of ModalPopup extender with UpdatedPanel, containing data-bound controls will work pretty much out of the box with few caveats to consider, mainly with OK/Cancel buttons:

1. Place both OK and Cancel buttons outside the Update panel, otherwise when leaving the page you may get a JScript error "Microsoft JScript runtime error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.".
When client-side objects of the Update Panel are being disposed, the cleanup script tries to remove all registered handlers. If buttons are inside of the UpdatePanel, their handlers are still registered as for all child controls by default, but weren’t re-attached during the callback. Obviously, you can spend time and do it properly, but simply re-placing the buttons will do the job while keeping layout appearance unaltered.

2. Now our buttons are outside of the UpdatePanel and we need to make it aware of relevant Click events. So we will have to add trigger to serve the OK operation:


Same will do for a Cancel operation but it will work just fine (and with less code) by setting ModalPopup.CancelControlID property.

3. In the case of the Cancel button a ModalPopup “window” will be closed automatically but if you want it to be closed after the OK click, you should do it manually by calling the mpMyPopup.Hide() method.

4. If databound controls were changed on a callback then don't forget to call the UpdatePanel.Update() method to refresh the data.

5. Another important point to mention is that you have multiple popup control extenders on a page, including user controls that contain the extenders the Popup Control ID, and Cancel Control ID etc must be unique.

Most but not all information found at:
http://lazyloading.blogspot.com/2009/03/ajax-controls-toolkit-modalpopup.html

Friday 6 May 2011

Use Fiddler with Blackberry simulator

In order to use Fiddler with Blackberry simulators the MDS simulator needs to be configured to use a proxy by amending the config file for the MDS simulator.

This is as simple as opening the config file at 'C:\Program Files (x86)\Research In Motion\BlackBerry Email and MDS Services Simulators 4.1.2\MDS\config\rimpublic.property' for a default installation.

Once the config file is open you need to look for the section titled [HTTP HANDLER] and add the following three lines



The proxy port in this example is 8888 which is the default port used by Fiddler.

The complete HTTP handler section should look similar to the following:

Blackberry Simulator - Insufficient Network Coverage


I have been doing a bit of mobile web development and had a problem when testing the site in a Blackberry simulator.

The message displayed on the black berry when doing a postback reads 'There is insufficient network coverage to process your request. Please try again later.'

The simulator has full signal and 3g etc is enabled. After doing a bit of research it appears the message is displayed becuase the page is trying to submit the form with a 'POST' action which causes this problem on both the Blackberry simulator and actual Blackberry devices. To get around this issue you can specify the form method to use 'GET' which resolves the problem.

eg:

Wednesday 4 May 2011

jQuery Mobile Document Ready not firing

I have had a problem when using jQuery Mobile document ready on a mobile web application. When jQuery navigates to a new page, the only content that is rendered is contained in the div with data-role 'page'. My javascript was at the bottom of the page outside this div and not firing. I moved the javascript into the div with role 'page' and its now working.