I recently had to work on a pretty big ASP.NET page with lots of fields that needed to be validated.
To quote from the AJAX Toolkit page:
ValidatorCallout is an ASP.NET AJAX extender that enhances the functionality of existing ASP.NET validators. To use this control, add an input field and a validator control as you normally would. Then add the ValidatorCallout and set its TargetControlID property to reference the validator control.
Because we had over 30 text fields, it would have been really tiresome to add extenders manually to each of the validators. So a way to attach them dynamically was needed.
Fortunately, this is pretty easy to do by iterating through the Page.Validators collection, dynamically creating ValidatorCalloutExtender controls and adding them to the Page.
This post discusses how to auto center and auto zoom a Google Map to display all of the markers optimally.
In order to get accomplish this, you have to calculate the center point and zoom level manually via code. Fortunately this is pretty easy to do, you just need to calculate the minimum and maximum latitude/longitude of all of your markers and then get the center point of the resulting area (which will be a rectangle). (more…)Bookmark on del.icio.us
This article describes how SharpSpell is able to modify existing TextBox controls to display wavy red underlines below misspelled words.
Here’s an image to demonstrate what I mean:Bookmark on del.icio.us
I recently had to design a Windows Service that connects to several game servers via UDP, gathers stats, and then updates a MSSQL database.
These stats were then made available in real-time on a web-site written in C# and ASP.NET.
For the first version of the application, the web-site and Windows Service were completely independent. The web-site would just query the database and determine, or make a best guess about what was going on inside the Windows Service at that exact time. This worked pretty good, and although the database is now about 1GB in size and growing fast, I optimized it good enough for this to work in real-time without a hitch.
There was some caching going on, thanks to the OutputCache directive in ASP.NET, but surprisingly enough there were no performance issues.
All right, so because I needed to display some extra information about â€˜onlineâ€™ users, that the Windows Service knew about, but the database didnâ€™t, I decided to have a look at .NET Remoting. This was my first time working with it.
These were the issues I experienced (as a Remoting newbie) when rewriting the Windows Service to be accessible via .NET Remoting: (more…)Bookmark on del.icio.us
What does this have to do with C#?
The theme has one flaw:
While I’m pretty sure that back in 2005 screen resolutions such as 800×600 were still common, in today’s world the theme is just too narrow for a big screen display, and too much space is lost.
This is especially a problem with a blog such as mine because I frequently use code samples, and lines can get pretty long.
So, I decided to keep the theme, but I modified it to make it exactly 200 pixels wider. I also added a Latest Posts display to the right navigation bar to improve the overall usability, and more importantly: Widget Support (more…)Bookmark on del.icio.us
There is apparently no easy way to generate a transparent GIF image using the .NET framework. Microsoft provided a method in the Bitmap class called MakeTransparent() but it doesn’t work for GIFs, it only seems to work for PNGs.
To create a transparent GIF you need to recreate the color table of the image using Imaging APIs, as detailed in this KB article . Unfortunately, this can be pretty slow for an ASP.NET Web application, and it has a lot of overhead, so I needed an alternative. (more…)Bookmark on del.icio.us
Many people are wondering how SharpSpell is able to provide wavy underline spell checking for regular HTML TEXTAREA elements. Other competitors replace TEXTAREAs with editable IFRAMEs to provide the same functionality, but this is an invasive method that we strongly discourage.
The trick is to try to replicate the content of the TextArea as best as possible using a DIV that is positioned directly underneath the textbox. The TextArea’s background is then set to transparent, and the DIV shows up through it.
We then send the text in the TEXTAREA to the server using AJAX calls, retrieve misspellings and suggestions, and we then recreate the DIV on the client using CSS to display the underlines.
Since everyone seems to be doing it 1, I decided to start my own blog to write about my day to day experiences with web development and programming.
1. yes, I realize that I’m starting way too late on the blogging phenomenon timeline, but better late than never right 2 ?
2. what better way to start a blog than with a clichÃ©?
Who am I?
My name is Andrei Alecu and I’m a C# developer with over 5 years of experience in .NET, owner and lead developer of Tachyon Labs, a company that started as an outsourcing studio but later developed as a .NET component developer and web development company. Tachyon Labs is also the company behind SharpSpell, a real-time spell checker control for ASP.NET and WinForms. (more…)Bookmark on del.icio.us