Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact

NAVIGATION - SEARCH

C# .NET: Convert System.Drawing.Color to HTML color

Here is a small example of how to convert a System.Drawing.Color to the HTML color format (Hex value or HTML color name value) and back. System.Drawing.Color c = System.Drawing.ColorTranslator.FromHtml("#F5F7F8"); String strHtmlColor = System.Drawing.ColorTranslator.ToHtml(c);

ASP.NET 2.0: v0.02 of my Virtual Earth v3 Ajax Server Control

Update (11/7/2007): This control is now located here: http://codeplex.com/pietschsoftve3 I just uploaded a new release (v0.02) of my ASP.NET 2.0 Virtual Earth v3 Server Control. The download contains a Visual Studio 2005 solution that contains the source code for the server control dll and a sample website that uses the control. The only new feature in this release is full ViewState support. I do plan on adding many more features to this control as I get time to work on it. Enjoy! Down... [More]

ASP.NET Atlas is full of JavaScript goodness

I was looking through the JavaScript code for Atlas and I noticed there is some pretty neat stuff in there. It is really a very large enhancement to JavaScript. One of the things I noticed is they are adding support for the XMLHttpRequest object if the browser doesn't natively support it. In the past I've traditionally just created a function named similarly to 'CreateXMLHttpRequestObject' and I make that function support multiple browsers. The technique that's used in Atlas is they are adding ... [More]

Scrape Geocodes from Google Maps w/ C#

I need to geocode some addresses once in a while and I notice if you view the source of the Google Maps page, the geocodes are right there. So instead of looking at the source of the page manually, I just created a little app that scrapes them from the page for me and places them into textboxes. Below is a small code snippet I wrote that does just that. It's not perfect but it is simple and it just plain works. string lat = "";string lng = "";string address = "1 Microsoft Way, Redmond WA"; ... [More]

ASP.NET 2.0: Virtual Earth v3 Ajax Server Control - PietschSoft.VE3 v0.01

Here is v0.01 of my ASP.NET Virtual Earth v3 custom control. The zip file download contains the DLL code and a sample test website. PietschSoft.VE3 v0.01 Features: Display map on a page with server side parameters (latitude, longitude, zoom, map style, etc.) Ability to attach JavaScript functions to the events raised by the JavaScript VEMap object from within server side code. Ability to plot points on the map from with in server side code I am modeling the objects in my li... [More]

ASP.NET 2.0: Place JavaScript inside the Page.Header

The Page.ClientScript object allows you to place JavaScript inside the Page, but it's limited in the fact that you cannot use it to place JavaScript inside the Head tags of the Page. But fortunately there is a way to do this. Add a .js file include inside the page header: [code:c#] HtmlGenericControl Include = new HtmlGenericControl("script"); Include.Attributes.Add("type", "text/javascript"); Include.Attributes.Add("src", "http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"); this.Page.H... [More]

JavaScript: Loop through all elements in a form

Since I've been doing alot of JavaScript programming lately, I figured I could start blogging some code snippets. Here is a JavaScript snippet that shows how to loop through all the elements in a form and retrieve their element type, name and values. I had to use this code to gather all form values so I could post them to the server using AJAX. <html> <head> <script type="text/javascript"> function DisplayFormValues() { var str = ''; var elem = document.... [More]