@bobnoordam

Author: bobnoordam

Passing data to an SqlDataSource on a user control from code

This code snippet demonstrates how to programmaticaly set a parameter on a user control, and bind that paramter to an SqlDataSource that has been configured at design time. The key to this functioning is a method in the usercontrol that sets a private field on the user control, and triggerin the DataBind() event on the […]

Reduce an image with transparant background to the minimum required canvas

This static method reduces an image with a transparant background to the minimal canvas needed. This code is part of my graphics processing library (PDrawing) and is hereby donated to the public domain. This process is best performed in a pre-process or background processing way, since it may take several seconds to process a large […]

ASPxImageSlider – Resize slider for different devices

This code sample shows how to resize the ASPxImageSlider control for different devices and screen resizing. (thing rotating your tablet). The slider exposes a client side ID (ClientInstanceName = “imageSlider”) which can be hooked into with a little javascript. While this solves the basic problem, of having the slider react to different screen sizes, you […]

GPO – Switch of the option to store password for rdp sessions

Storing the password for RDP sessions is a bane for any administrator that manages remote users, Here is how to disable the option to store the rdp password thgrough a group policy object. – User Configuration + Administrative Templates + Windows Components + Remote Desktop Services Select Remote desktop connection client Enable the policy named: […]

GPO – Allow or disallow UDP for Remote Desktop sessions

Recent versions of the rdp protocol (since v8) are capable of using TCP and/or UDP for connections. USP can be an improvement on low quality networks, but it can also greatly hamper other UDP based services on busy networks. I have also see it cause problems in connecting and disconnecting when using confused routers or […]

MVC – Return a file download from an MVC controller

#1, Return a byte[] as a download Use case; You have an in memory byte[] array containing something you want to offer as a a download. (For example an excel sheet) string fileName = “something.xls”; return File(result, System.Net.Mime.MediaTypeNames.Application.Octet, fileName); #2 Return a text file as a download Here we trick the browser to offering the […]

MVC and Linq2Sql – Getting your data in and out of the model

MVC supports a lot of ‘good practice’ such as dependency injection, unit testing and mocking. These things all have their place, but for some small ad-hoc coding all of that isnt’s needed. Additionaly, people crossing over to MVC get confornted in most books and documentation with a ton of good advice that at best obfuscates […]

Handle your thread errors

If you use Task.Factory.StartNew or one of it’s likes a lot, you may found yourself in the odd situation that exceptions from background threads either get delayed or do not appear at all. This behaviour is rather well described here including special conditions such as backgroundthreads started by other background threads. The long story short, […]

Next Page » « Previous Page