Wednesday, September 20, 2017   Search   Login  
  • .NET Programming
  • ASP.NET Website Design
  • DotNetNuke Modules
  • Photography
  • Videography
  • Video Editing
Projects » Web Controls
ASP.NET 1.1 and 2.0 Web Control Projects

Over the past several years WESNet Designs as produced a number of ASP.NET 1.1 and more recently ASP.NET 2.0 custom web controls and user controls for use in the development of various websites.  From time to time we'll be making those of a more general purpose available for free download to registered users of this site.  All are offered without warranty and without support except via postings on this sites forums. Visit the Downloads page to give these helpful controls a try in your site!

As these are offered free of charge, I can't really support them but as time permits will try to answer any questions or reports of bugs that you post in the WESNet Designs Forums.


ASP.NET 2.0 Color Picker
This past week I needed a color picker web control for a DotNetNuke module settings page. After looking at several on-line sources for web controls I decided that I wanted one that relied on client-side DHTML scripting. As I do not consider myself well versed in writing complicated Javascript, I began searching some of the on-line libraries of free scripts and was pleased to come across the Matt Kruse's Javascript Toolbox (www.javascripttoolbox.com) where I found a nice color picker script around which I could wrap an ASP.NET 2.0 composite control. Here's a demonstration of the resulting control:
Some of the features of the include selection of the color by: 1. Entering desired color by name or color value in the textbox followed by a tab updates the color square. 2. Clicking on the color square pops up a table of web safe color from which the desired color may be selected by clicking a color cell. 3. AutoPostBack may be enabled in which case any change of color value in the textbox or color table raises a server-side ColorChanged event. 4. The visual display of the control is highly customizable with either a flow or table layout.

    
ASP.NET 2.0 ExtendedCheckBoxList
For some time now I've been seeing ASP.NET forum posts relating to a desire to have a CheckBoxList control which offers checkboxes to select (preferably through client-side code to avoid a postback) either ALL or NONE of the checkboxes. There have also been posts desiring the ability to set a maximum number of checkboxes which can be selected - say only three out of 10 checkboxes. While I never had need for the latter capability, I often needed the ALL or NONE capabilitity and would implement it either server-side (which requires a postback) or if I had time with the ALL or NONE checkboxes being separate from the CheckBoxList and having their onClick attribute set to call a simple Javascript function that would then set or clear all of the other checkboxes.

I had thought several times in the past of implementing this same behavior in a custom ExtendedCheckBoxList web server control, but had been deterred from it by my previous experiences in trying to extend the DropDownList at which time I struggled with ASP.NET 1.1's lack of persisting and rendering Attributes added to the ListItem object which is used in the framework's ListBox, DropDownList, CheckBoxList and RadioButtonList controls. I had also found that many of the classes which would need to be overriden (such as ListItem itself) were marked as sealed/uninheritable.

With the release of ASP.NET 2.0 I hoped that these various classes would have been rewritten to allow one to add attributes to ListItem and to have them properly persist and render. The good news is that ListItem now renders added attributes. The bad news is that they still don't persist across postbacks and have to be added both on the initial load and on subsequent postbacks. With a bit of time on my hands, I decided to see what could be done with a bit of Javascript and overrides of as few classes as possible. I believe that I was quite successful and will soon post be adding the resulting ExtendedCheckBoxList web server control to my offering of free, downloadable ASP.NET 2.0 web controls.

The ExtendedCheckBoxList allows one to set properties such as EnableAllCheckBox, AllCheckboxText, EnableNoneCheckBox, and NoneCheckboxText to automatically include in the CheckBoxList the desired "All" or "None" checkboxes. Clicking on ALL or NONE will have the expected behavior. Clicking on the other regular checkboxes in the list will also set or clear the ALL or NONE checkboxes when all or none of the regular checkboxes are checked. Another property MaximumChecksAllowed can be set to limit the number of checkboxes that may be selected to a value less than the total number of regular checkboxes in the list. All of this has been implemented and is working well.

In a DNN module settings page, I also needed the capability of having several "grouped" ExtendedCheckBoxLists which all include the same list options with the condition that an option may be selected in ONLY one of the "grouped" lists. Although this "grouped" list capability is probably rarely needed it was an interesting exercise to determine the best way to implement it.

Here's a sample of the various uses of the ExtendedCheckBoxList:
    
  Minimize

Website design by WESNet Designs, William Severance
For comments, link requests, etc. please contact webmaster@wesnetdesigns.com

    
Home  |  About Us  |  Forum  |  Downloads  |  Bill's Blog  |  Contact Us  |  DNN Gallery Test
Copyright 2005-2011 by WESNet Designs   |  Privacy Statement  |  Terms Of Use