Our mission Here is what we want to archieve with a standard ASP.NET gridview; We want scroll bars to scroll vertical in a potential long list When a row is selected in the gridview, we want to maintain the scroll position in gridview. (de default behaviour would be for the grid to jump back up […]
Month: February 2020
Securing session cookies in asp.net
Securing session cookies by itsself is very straightforward. By adding the following markup to the system.web section in web.config your session cookies will no longer function without https. <httpCookies requireSSL=”true” /> However, this will give you a new problem if you run in a test environment or debug session without https. Since the cookie will […]
MVC and Linq2Sql – Adding validation
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 confronted in most books and documentation with a ton of good advice that at best obfuscates […]
Monitoring the file system for changes
This code sample sets up a handler to monitor the c:\ disk for changes in any file’s size, and report those changes to the console. Imports System.IO Module Module1 ”’ <summary> ”’ Display the change events detected by the file system watcher on the console ”’ </summary> ”’ <param name=”sender”></param> ”’ <param name=”e”></param> ”’ <remarks></remarks> […]
Raising an event on a usercontrol, and subscribing to it from an ASPX page
This is a minimalistic demonstration on hooking into an event risen by a usercontrol. The main page subscribes to the event on the user control, and once the usercontrol raises a postback the event data is retrieved. User control code using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace UsercontrolEvents { […]
Collecting performance data from local and remote systems using C#
Performance data Perfmon is a well known tool to monitor performance data for your local and remote systems. This code snippet gives you a worker class that can be used to connect to local or remote perfmon / system performance data, and provide the resulting information stream to your c# application. Local and remote To […]
Enumerating available performance counters on local and remote systems using C#
Performance counters Perfmon, the well known tool for monitoring performance counters has a nice list of categories and counters for your system. But what if you want to access a counter from code ? Or even worse, want to check if a certain counter is available or not ? In the previous document Collecting performance […]
The absolute minimal jQuery reference
Selectors Used to find elements in your page to do some processing with $(“#menu”) // find the element with the id of menu $(“.someClass”) // find ALL elements with the class someClass $(“h1”) // find All <h1> elements $(“#menu li”) // find all <li> elements in the list with id “menu” Display the value of […]
Creating a threaded windows service
Below is a more or less empty sample from a window service project, you can build in Visual Studio. The service itsself (created by the VS Project) has events for Start and Stop command, which you use to hook your worker code into: Example of an empty worker, which does not do more then writing […]
MVC – Using icons as standard buttons and submit button
The View The following markup defines two images as buttons. Standard GET behevaiour is the simple one of the two, it isnt anything else then an image wrapped into a link. The @Url.Action calls the required action on the controller. The submit button is an actual button. The mini CSS snippet makes sure we dont […]