So I have researched what other color picker controls do and decided to write the one myself that I would base on Microsoft AJAX .NET platform. After some considerations I've decided to go even further and build an AJAX Control Toolkit Extender control.
As an example I took an AJAX Control Toolkit Calendar extender and in my Color Picker extender control I also internally used another AJAX Control Toolkit control: Popup extender.
So what are the advantages of implementing a client control as an ASP.NET AJAX extender?
- You use ASP.NET page mark-up to render the control content to the browser.
- No need to manually inject JavaScript, HTML and other resources.
- You develop JavaScript code in a standalone file leveraging ASP.NET AJAX framework and Visual Studio intellisense abilities.
- JavaScript per se is very well structured, easy to read and debug.
- Many of the hassles of JavaScript client coding such as cross-browser compatibility, event handling, asynchronous calls are taken care of by ASP.NET AJAX framework.
So I have spent a few days coding the control and finally it's out there. I have created a Codeplex project for it so if you are interested just go there and download the control and a Demo Web site.
Now just a few more words about the extender. First, this is how it looks:
Second, it's extremely easy to use. The extender attaches to an ASP.NET TextBox server control and to an optional button that can open a popup window and an element that samples a selected color in the background. User selects a color by clicking on a colored area. Below is a code example of using an extender on an ASP.NET page.
<asp:TextBox ID="TextBox1" runat="server" Columns="7" MaxLength="7">asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/icon_colorpicker.gif" />
<cdt:ColorPickerExtender ID="cpe" runat="server"
TargetControlID="TextBox1"
SampleControlID="ImageButton1"
PopupButtonID="ImageButton1"
/>
Feel free to download the extender from the Codeplex, try it and post any comments or suggestions on the Codeplex project page.
No comments:
Post a Comment