Friday, 28 December 2012

Team Foundation Server The path is already mapped in workspace

This problem can occur when trying to change the collection a project is mapped to. Its to do with the TFS cache on the local machine. You can resolve the error by deleting the cache files at:

%APPDATA%\Local\Microsoft\Team Foundation\4.0\Cache

If you are using an older version of team foundation server then change the version number to match.

Monday, 10 December 2012

DevExpress how to validate all tabs

separate each page of controls by Validation Group.

Devexpress, how to validate page from javascript

If you have a button, and want to call devexpress validation before doing anything else this can be achieved with the below javascript on the click event of the button.

Saturday, 8 December 2012

How to get XNA game studio install working on windows 8

Tuesday, 6 November 2012

ASPxComboBox clear selection on delete or backspace

If you are using a DevExpress ASPxComobobox and you want to be able to unselect an item you can use the below code:

Friday, 2 November 2012

How to close the browser window without a prompt

If you want to close the browser window in with javascript but dont want to prompt the user you can use the below code:

Thursday, 18 October 2012

Microsoft ReportViewer - Change Subreport at runtime (rdlc)

Its possible to change a subreport at runtime using the below code. Both reports need to be loaded from a Stream in order for this to work, but is easily achievable by adding a method to the reporting library to handle this. The reporting Assembly contains a 'Common' Class with the following static methods: And to call this code from my web application the following code can be used

Friday, 12 October 2012

ASPxGridView Response.Redirect cannot be called in a Page callback.

If you need to redirect from an ASPxGridView you may have seen the message: Response.Redirect cannot be called in a Page callback. In order to get around this, DevExpress have added a method to the base webcontrol to redirect in a callback. For Example:

Thursday, 27 September 2012

Devexpress method to register base scripts

If for some reason devexpress scripts dont get registered there is a method on the base control to register scripts.

Thursday, 6 September 2012

SQL script to set Simple Recovery and Shrink logs for all database

Wednesday, 22 August 2012

How to Set a DataItemIndex for a devexpress ASPxGridView

To Get a DataItemIndex in an ASPxGridView I suggest you add an unbound column to your ASPxGridView that will contain the row datasource index. Handle the server-side ASPxGridView.CustomUnboundColumnData event to provide data to this column. Use the ASPxGridViewColumnDataEventArgs.ListSourceRowIndex property to get the processed row's datasource index. Then, you can get data from this unbound column by using the server-side ASPxGridView.GetRowValues method. You can use this code to implement this task: After that, use this code to get the row's datasource index by its visible index:

Monday, 20 August 2012

Select distinct on one column but return all rows

Tuesday, 14 August 2012

ASPxPage Control Cannot unregister UpdatePanel - Post 2

Just had this issue again, this time without using tab pages. it looks like there are issues redirecting from an ASPxGridView row command. The only hack Devxpress can provide so far is re-registering the controls when they are unloaded. this obviously relies on microsoft never changing their code. To sort, all update panels need to reregister when unloaded! I added a method to my base page as follows: then this can be called on ALL updatepanel unloads

Wednesday, 8 August 2012

How to hide readonly fields from devexpress ASPxGridView inline edit

It appears you can hide controls using the ReadOnly/Visible properties of the edit controls in an ASPxGridView with inline edit mode. Instead you have to change the EditItem template for the column to contain some blank text or a

Tuesday, 7 August 2012

Intelliesense not working in Visual Studio

Hi Just a quick not to say about issues with intellisense not working in Visual Studio. I had controls registered in the web.config but intellisense was not picking them up. After a bit of searching I found some duplicate entries in the web.config. removing these duplicates sorted the issue. It seems if there are any problems in the web.config file then intellisense wont work.

Friday, 3 August 2012

ASPxPage Control Cannot unregister UpdatePanel

I recently had a problem when using the Devexpress Page control wiht update panels in the pages. I have code to hide/show tabs based on certain settings, but the error: Cannot unregister UpdatePanel with ID 'upLoginActivityGrid' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported. Parameter name: updatePanel was shown by the .net runtime. after a little investigation this can easily be solved by hiding the tabs client side rather than server side. so changing the code from this: to this: solves the problem

Thursday, 2 August 2012

Devexpress combobox datasource lost after postback

If you are using devexpress comboboxs and the datasource is null after postback. this may be becuase the combobox is set up to use multiple columns. If this is the case then multi column comboboxes need to be rebound on each postback to ensure the items still exist.

Wednesday, 1 August 2012

ASPxButton in RoundPanel used as an Update Panel trigger

Controls in a Dev Express round panel are renamed due to being in an INamingContainer. This means that the Ajax update panel cannot find the controls. to work around this issue, triggers can be added when the update panel is initialised. If this does not work then you can register the control for postback directly with the current Script Manager

Friday, 20 July 2012

DevExpress ASPxGridView find row index in Row Deleting Event

To find the row index of the row being deleted in a devexpress grid view you can use the code below: note: the KeyValue field must be set on the grid for this to work, if there is no id on the datasource, I just returned a unique GUID to differentiate between records.

How to populate DevExpress GridView combobox header filter

You need to subscribe to the AutoFilterCellEditorInitialize event. Check the column name, and cast the control to set the datasource.

DevExpress GridView restore selected items after page changing

If you have a dev express grid with paging enabled the selected items get lost after the page is changed. Note: Its important to call PerformCallback() on the gridview when the header checkbox is checked, otherwise the server does not know about the selected items to restore after the grid is rebound. To fix this issue use the code below: Code Behind:

How to select all items on a page in a DevExpress gridview

If you want to add a checkbox to a DevExpress Grid view to select all items on a page it can be achecived with the following:
Note: in order for the CheckBox script to be able to access the gridview, the ClientInstanceName property must be set. Also, if you want the server side selection changed event to be fired, you will need to call PerformCallback on the grid to update the server.

Thursday, 12 July 2012

How to use the DevExpress combo box with large datasources

ASPX ASPX Code Behind NOTE: there are +1's on the begin and end indexes, without this, scrolling does not work when filtered. Nominal account class (with paging)

Monday, 21 May 2012

How to Uninstall IE8 from windows XP SP2

To uninstall Internet Explorer 8, follow these steps:
  • Carefully select and then copy the following command: %windir%\ie8\spuninst\spuninst.exe
  • Click Start, and then click Run.
  • In the Open box, type Cmd.exe, and then press Enter.
  • Right-click inside the Cmd.exe window, and then click Paste to paste the command that you copied in step 1.
  • Press Enter to uninstall Internet Explorer 8.
  • After the program is removed, restart your computer.

Friday, 11 May 2012

jQuery how to FadeOut() then Remove()

How to stop click events firing on child divs

If you have multiple divs stacked on top of each other, and all divs are selectable (ui-selectable) you can stop the click events bubbling down to the lower level by adding event.stopPropagation() to the click event of the top most div. eg:

Sunday, 6 May 2012

Deserialize json object with a date time to a c sharp oject

If you want to deserialize and object that has been serialized with the JavaScriptSerializer and it contains a date time object then you may run into a parser / format error for the date time. this can be fixed by doing a replace on the string before deserializing.

Wednesday, 25 April 2012

jqGrid Ensure last edited cell is saved when save button clicked

I had a jqGRid that is shown in a jQuery dialog. The dialog has a save and cancel button. A problem occured where the last column in the grid was edited, but as the user did not press enter to commit the cell value, the last value entered in the grid was not saved when the 'Save' button was clicked. To get around this, I saved the current row and column indexes in the afterEditCell Method, then called my custom save cell method (saveCurrentCell) when the OK button is clicked on the jQuery dialog. This ensures that the last cell being edited is saved before the dialog is closed. Markup: Javascript:

Tuesday, 13 March 2012

Error: Sys.ParameterCountException: Parameter count mismatch.

I had a gridview inside an update panel with a checkbox set to auto postback but every time it was clicked the parameter count mismatch error was being thrown by the ajax framework.

To get this working it was simply a case of setting the ScriptManager script mode to release so this error did not get thrown.


Wednesday, 29 February 2012

Convert decimal hours to Time String

If you need to convert a decimal number of hours, to a time string. This can be achieved with the below code;

Wednesday, 8 February 2012

Drop down list can only have one selected item

If you get this error when binding a drop down list to a new datasource,

try creating a list item out of the current selected text and value, add it to the list then call databind.

Tuesday, 7 February 2012

How to fire an async postback from javascript

Wednesday, 1 February 2012

How to set the width of jQuery ComboBoxes

function configureComboxes() {
$('.ui-autocomplete-input').css('width', '90%');

Visual Studio - Get Rid of Meta:Resource key

Within Visual stdio find and replace use the following regex to remove all of there extra tags.

if you want to get rid ofMeta:Resource key

use this regex


Visual Studio - get rid of __Designer Mapid

Within Visual stdio find and replace use the following regex to remove all of there extra tags.

if you want to get rid of __designer:mapid="22"

use this regex


Friday, 27 January 2012

How to to save an rdlc to PDF programatically

If you need to save a report viewer report to PDF via cocdeit can be achieved with the below code.

Thursday, 12 January 2012

Restoring focus to a control after an UpdatePanel Update

Using Ajax update panels can sometimes cause issues with restoring the focus of the control after the update panel updates.

This can be achieved with a little jQuery and hooking the begin and end request events of the PageRequestManager.

Tuesday, 10 January 2012

How to have an editable checkbox column in a jqGrid

If you need to have clickable checkboxes in a jqgrid that update immediately then this is the code for you. It took me about a day and a half to get this worked out!