Archive for January, 2010

Test your ASP.NET knowledge on an Android phone !


A free Android application for testing your ASP.NET Development Knowledge.

[ Check it out here. ]

Unwinding the page lifecycle events

Since I spent some time today working with control extenders and exactly where in the page lifecycle to do what, I thought I’d share the whole list.

If (!IsPostBack)

  1. Begin PreInit
  2. End PreInit
  3. Begin Init
  4. End Init
  5. Begin InitComplete
  6. End InitComplete
  7. Begin PreLoad
  8. End PreLoad
  9. Begin Load
  10. End Load
  11. Begin LoadComplete
  12. End LoadComplete
  13. Begin PreRender
  14. End PreRender
  15. Begin PreRenderComplete
  16. End PreRenderComplete
  17. Begin SaveState
  18. End SaveState
  19. Begin SaveStateComplete
  20. End SaveStateComplete
  21. Begin Render
  22. End Render


  1. Begin PreInit
  2. End PreInit
  3. Begin Init
  4. End Init
  5. Begin InitComplete
  6. End InitComplete
  7. Begin LoadState
  8. End LoadState
  9. Begin ProcessPostData
  10. End ProcessPostData
  11. Begin PreLoad
  12. End PreLoad
  13. Begin Load
  14. End Load
  15. Begin ProcessPostData (Again)
  16. End ProcessPostData (Again)
  17. Begin Raise ChangedEvents
  18. End Raise ChangedEvents
  19. Begin Raise PostBackEvent
  20. End Raise PostBackEvent
  21. Begin LoadComplete
  22. End LoadComplete
  23. Begin PreRender
  24. End PreRender
  25. Begin PreRenderComplete
  26. End PreRenderComplete
  27. Begin SaveState
  28. End SaveState
  29. Begin SaveStateComplete
  30. End SaveStateComplete
  31. Begin Render
  32. End Render

Podcast – Scott Hunter on Web Forms in ASP.NET 4

Episode #4 – Scott Hunter on Web Forms in ASP.NET 4

In this episode The Misfit Geek talks with Sr. Lead PM, Scott Hunter about Web Forms in ASP.NET 4 and how ASP.NET Developers are changing the way they build Web Forms Applications.

 Resources ……

If you are interested in advertising, have suggestions, or advice…. Please CLICK HERE and send them to me. 

Download Now !

Download MP3 Download WMA Download WMA-Fi Download ACC 

Implementing a jQuery Modal Window in ASP.NET

I’ve recently had several questions about attempts to use the Ajax Control Toolkit’s Modal Dialog, or more accurately, to misuse it, as a window.

It’s a “dialog” and therefore not well suited to being used for receiving data from the user.

Controls like the Modal Dialog Extender Control are convenient when they do when we want them to do but when they don’t there is no reason not to “roll our own” functionality.

In this case I’ve built a sample using jQuery to display a Semi-Modal Window to allow the user to edit a field on the page.

I say “semi” Modal because clicking outside the Window causes the edits to be aborted, the Window to be closed, and the page to be visually restored.

The page normally looks like this…….


Then Clicking on the “Edit Photo Caption” link causes this to happen.


In this dialog one can edit the caption that appears below the photo.

The interesting thing here is that, though I’m using jQuery to display the Window, the rest is plain ASP.NET server controls and code behind.

The “Save” button is an ASP.NET button control which means that there is a Server-Side event handler where I can process they newly entered Photo Caption.

In the case of this demo I just update the page display but we could also use that Click event handler to persist the changed data to a database since it runs server side. (No “services” required.)

The Code…

I start with generating a default ASP.NET 4 Web Forms Application with Visual Studio 2010

Then we pull jQuery via a reference in the master page.

<script type="text/javascript"

Note that the new Web Forms project template in Visual Studio 2010 includes versions of jQuery and even one that has IntelliSense support but I’ve opten to dynamically bull the latest version directly from the jQuery code repository.

Next, we have some styles added to the generated Style.css file to handle making the page opaque when we show the Window as well as styles for the Window itself.

   1: #mask

   2: {

   3:   position:absolute;

   4:   left:0;

   5:   top:0;

   6:   z-index:9000;

   7:   background-color:grey;

   8:   display:none;

   9: }


  11: #boxes .window {

  12:   position:absolute;

  13:   left:0;

  14:   top:0;

  15:   width:440px;

  16:   height:200px;

  17:   display:none;

  18:   z-index:9999;

  19:   padding:20px;

  20: }


  22: #boxes #modalwindow {

  23:   width:375px;

  24:   height:203px;

  25:   padding:10px;

  26:   background-color:#ffffff;

  27: }


  29: .stylecenter

  30: {

  31:     text-align: center;

  32: }

 Next we have the code for displaying the Window. Note that this jQuery code is bound ONLY to a DOM <A> Element named “modal”.

Lets look at the code and then I’ll call out a detail or two.

   1:      <script type="text/javascript">
   2:          $(document).ready(function () {
   4:              // Set up for displaying modal dialogs
   5:              $('a[name=modal]').click(function (e)
   6:              {
   7:            // Prevent the default link behavior of navigation so we can
                    use the link to show the Window
   8:                  e.preventDefault();
  10:                  // Determine which href was clicked if it was in fact an href
(though this demo as only one.) 
  11:                  var id = $(this).attr('href');
  13:                  // Determine browser windows dimensions. 
  14:                  var maskHeight = $(document).height();
  15:                  var maskWidth = $(window).width();
  17:                  // Set dimensions for the mask to opaque the screen when 
                        the modal window is displayed.
  18:                  $('#mask').css({ 'width': maskWidth, 'height': maskHeight });
  20:                  // Make the Window Opaque        
  21:                  $('#mask').fadeIn("fast");
  22:                  $('#mask').fadeTo("slow", 0.8);
  24:                  //Get the window height and width
  25:                  var winH = $(window).height();
  26:                  var winW = $(window).width();
  28:                  // Set the Modal Window's dimensions to center in the 
                          browser window.
  29:                  $(id).css('top', winH / 2 - $(id).height() / 2);
  30:                  $(id).css('left', winW / 2 - $(id).width() / 2);
  32:                  // Show the Modal Window
  33:                  $(id).fadeIn("fast");
  35:              });
  37:              // Handle Close Button Click Event
  38:              $('.window .close').click(function (e) {
  39:                  // Cancel the link behavior
  40:                  e.preventDefault();
  42:                  $('#mask').hide();
  43:                  $('.window').hide();
  44:              });
  46:              // The user clicks OUTSIDE the Modal Window and the window will be 
                      closed without save.
  47:              $('#mask').click(function () {
  48:                  $(this).hide();
  49:                  $('.window').hide();
  50:              });
  52:          });
  53:  </script>

We should also note the HTML for the like and the Window to be shown when that like is clicked.

<a href="#modalwindow" name="modal">Edit Photo Caption</a>
<div id="boxes">
<div id="modalwindow" class="window">
<center>Enter New Caption</center><br />
<asp:TextBox ID="ClientDataTextBox" runat="server" ClientIDMode="Static"
    TextMode="MultiLine" Height="120" Width="370"></asp:TextBox><br />
<asp:Button ID="ModalButton" runat="server" Text="Save" onclick="ModalButton_Click" />
<!-- Mask to cover the whole screen -->
<div id="mask"></div>

 Note the line …..

$('a[name=modal]').click(function (e)

“modal” is the name of the <A> object that for opening the Window.

Note that the href= is set to the same name as the id of the <DIV> to be displayed when the <A> is clicked and it is that relationship that causes the related Window to be displayed.
The cool thing about this is (to me anyway) how I can intermingle ASP.NET and jQuery JavaScript. The fields in the Modal Window get processed in my Code-Behind so I don’t need to write extra JavaScript to fetch and handle the new Photo Caption and I don’t need to write Ajax service Methods to handle Server Side processing of that new data,
For me it is this sort of change in style that is indicative of the “new” ASP.NET Web Forms developer.
You can grad a zip file of the ASP.NET 4 project [ HERE ]
Have Fun !
PS: I adapted code from this post  to ASP.NET and Failed to give attribution to the original author.  My apologies to Queness.
Technorati Tags: ASP.NET 4 jQuery Modal Window Code

Updated Web Community Application

I’ve posted the first set of minor updates to my new Web Community Application Project at

Updates include….

  • Migrated to ASP.NET 4Beta.
  • Add Daily News Updated and Downloads Page.
  • Add Membership & Rolls with SQL Express.
  • Add Global Properties like Site Name, Slogan.
  • Refractor Controls and MasterPage.

Note that the code for each update is downloadable.


Use this code at your own risk. I, and Microsoft, make absolutely NO expressed or implied warranty what so ever.

This sample code is provided for your enjoyment, it is not supported and it is not official Microsoft “best practice”.

I offer it only for any learning value you may derive from it.

You can find a link to the updates page on the top menu at


Technorati Tags: Microsoft ASP.NET NETOOP Source Code

Help me decide what to focus on for thenext 6 months.

Please take this poll !

Building an Awesome Community Web Site

Some time ago I started playing with the idea of organizing an Open Source project to build a CMS.

It generated a lot of interest, but the “expectations” seemed overwhelming to me. NETOOP is not dead, I still plan to build it but I intend to build version one myself (On MVC) and release it as FREE source.

In the mean time, I’m planning what content to build for 2010 and have decided to do a collection of projects based on building a great community site.

I’m going to write the code and record videos detailing the implementation or the parts.

I hope YOU will suggest and discuss features with me here on my blog! I will release the code as FREE/MSPL at different milestones.

The “design” that I’m starting with is live at


It’s currently deployed on .NET 3.5 on Web Forms.

  • I’ll be updating to ASP.NET 4 very soon.
  • I will be doing a MVC version.
  • As much code as possible will be modular and transportable.

The first features I’ll be working on are…….

  • Add ASP.NET Membership System
  • Add Roles
  • Add CUSTOM Profile System
  • Add Daily Notice Admin Editor (Admin Only, Rich Text Editor)

Please share your thoughts and feature ideas and don’t worry if MMA is not your thing.

I just chose a sports application so we could have fun with rich media features !!!!!


Technorati Tags: Microsoft ASP.NET CMS MMA UFC How-Do-I

I guess I suck.

🙂 Why is it that folks that wanna complain seem to always lack the courage to identify themselves of provide contact information?

Note to anonymous keyboard warriors.

1.) Consumption of web content is OPTIONAL and free. It you dislike, don’t consume.

2.) Constructive criticism and advice is always welcome. Inane vialness is not.

3.) A a general rule you should not write anything that you would not have the courage to say to me if you were standing within arms reach.

3.) If you want to be insulting, have the courage to include your real name and email address (and if you are really trying to be insulting, include your phone number and street address 🙂 )

It may be a new year – but some things haven’t changed.

You have contact request!

I Don’t Understand
From: NV (

I don’t get it. Your videos are helpful, but I can’t figure out if you like the sound of your own voice, or if you just have problems being a professional presenter. Can’t you just STFU and present rather than talking tons on tangents and repeating yourself constantly. Also, how about getting a foam filter to put over your mouth-piece so that we don’t hear those nervous, exaggerated plosives blowing-up your microphone every time you try to expressively explode from one of your own PERSONAL hold-up points. It can’t be that hard to relay what you’re trying to say without twitching the mouse around the screen nervously so much – in fact, trying to calm down, focus, maybe do a little scripting / outlining *might* help a bit. Otherwise, once I get past this crap (which you’re not showing any improvement over time), when I can stand to sit through your inane commentary, your videos are somewhat helpful (though cursory – if you really focused, you could pack much more of a punch).

You were sent this message because you are listed as an Editor on the site Misfit Geek

BTW – This is posted for fun. I get many great email from developer friends all over the world and there are far more “Good Guys” than there are jerks 🙂

The Great PHP on Windows Contest

Try your hand at PHP on Windows and win a complete 52″ HDTV home entertainment system and the opportunity to present your creation to the crowd at php|tek 2010 in Chicago with an all-expenses paid trip!

Have you tried to run PHP on Windows? No? 

That’s why PHP Architect is hosting the Great PHP on Windows® Contest!

The basics of the contest are simple:

  • Write a new application designed to run in PHP on Windows using IIS—or make a significant contribution to an existing open-source project along the same lines
  • The best application, selected jointly by a panel of experts and by our readers, will win a grand prize composed of a 52″ Digital HD home entertainment system, as well as an all-expenses paid trip to php|tek 2010 in Chicago.
  • Runner-up prizes include 2 XBox 360 Ultimate and subscriptions to php|architect.
  • Not familiar with Windows? No worries—we have partnered with Applied Innovations to give the first sixty participants absolutely free hosting on a pre-configured virtual machine for the duration of the contest.
  • The contest is open to residents of the United States only—but you can still win by voting, no matter where you are.

For more info :

BOOK : Murach’s C++ 2008


Yes, C++ is alive and well and as I always say, you just can’t go wrong with a Murach’s Book.

This is the book I would choose if I were going to teach a course on Managed Code C++ programming.

It starts at the beginning and works it’s way through OO concepts to advanced C++ 2008 language features and practical practices like working with events, XML files, etc.

Of no small interest, and one of the big advantages of doing .NET programming with C++ can be found in chapter 19 : How to work with legacy “C” and native “C++” code.

[Get it HERE ]

Technorati Tags: Book Murach’s C++