ASP.NET Popup Message Box User Control

by Bill Beckelman 15. July 2008 18:58

Update 31DEC08: Posted jQuery Alert Dialogs which creates these same dialogs using jQuery.

Alerting my users to some action that is about to occur or has occurred has always been a pain for me in web programming. Everyone has probably used Page.ClientScript.RegisterStartupScript to popup generic message boxes. Tonight I was looking for a better way to accomplish this task and came across Janko's post Create MessageBox user control using ASP.NET and CSS . He presents a great user control to display four types of messages. I decided to take things a little further by using the ModalPopup control from the AjaxControlToolkit as well as some additional CSS and images from Matt Berseth's post YUI Style Yes/No Confirm Dialog with the ModalPopupExtender. I also added the ability to set the height and width of the message container. Though far from perfect, I think its a good start for an evening's work. Please check it out and let me know if you have ideas to improve the control.

Demo | Download

Screenshot of End Product

errormessage 

infomessage

successmessage

warningmessage

 

My to do list:

1. Add the ability to dynamically set the header text.
2. Overload for default height and width or maybe figure out how big the box should be based upon the message string length.  

kick it on DotNetKicks.com      [dzone]

Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.4.5.7
Theme by Mads Kristensen


About Me

I live and work in Salt Lake City, Utah. My background is in aviation. I have a degree in Aeronautical Science from Embry-Riddle Aeronautical University in Prescott, AZ. I have worked as a commercial airline pilot and most recently as a technical advisor for a charter airline.