asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search





Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Archive
Writers
Code Samples
Components
Tools
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

Creating a Popup Date Picker -- Cont'd
By Conrad Jalali


  • email this article to a colleague
  • suggest an article

    Testing


    At this point everything is in place to achieve the desired functionality. Build and run your project to test the results. You should be able to launch the DatePicker popup by clicking on the "pick" link. The Calendar control should allow us to go to the next or previous month (via a post-back), just like a regular calendar. Clicking on a particular day should nearly instantly set the value of the TextBox control in the example form, and then close the popup.

    Possible Problems

    There are a few places to check if something isn't working properly. First, make sure that the InitializeComponent method in the code-behind file is attaching your DayRenderEventHandler delegate. VS .NET has an odd habit of clearing out the contents of InitializeComponent if you do a lot of switching between Design and HTML mode in your ASPX pages.

    If the page still doesn't work, you may have a JavaScript error. Remember, JavaScript is case-sensitive. Make sure that you are passing the correct "FormName.FieldName" to the calendarPicker function.

    When in doubt, debug. VS .NET will even allow you to debug JavaScript code. To debug JavaScript, go to the Internet Options dialog box in Internet Explorer (from the Tools menu). Make sure that "Disable script debugging" is not checked.

    With script debugging enabled, launch your project in debug mode. From the Debug menu, select Windows, and then Running Documents.

    In the Running Documents window, double-click on Default.aspx, and then set a break point in the JavaScript.

    When your browser calls hit the break point, control will switch back to Visual Studio, where you can examine the values of the JavaScript parameters within the script. This is too cool.

    Possibilities for Further Improvement

    To further reduce the number of postbacks, you could create your own "month picker" control so that users could get to a specific month in one step, without clicking next, next, next. There are lots of ways that you could extend and improve upon this simple example.

    Conclusion

    You don't have to forget everything that you knew about Web development prior to .NET. Microsoft has made it easy to extend the out-of-the-box functionality of Web Controls. I hope that this article illustrates that ASP.NET encourages you to be curious about how things work, and to change them.

    About the Author

    Conrad Jalali is the co-founder of Useful Studios, a design firm focused on usability. He has been working with Active Server Pages for the past five years, and specializes in ASP.NET with C# and SQL Server 2000. Conrad graduated from Sarah Lawrence College with a Bachelor of Arts in Liberal Arts, and is a Microsoft Certified Professional. He lives in the Washington, DC area, with his wife, Elizabeth, and his dog, Sparky. He can be reached via email at conrad@smallcog.com.

    << Introduction

    Rate This Article

  • Other Articles
    Apr 21, 2004 - Creating a Web Custom Control
    Conrad Jalali shows how to build Web custom controls by creating one that displays checkboxes in a categorized, hierarchical view.
    [Read This Article]  [Top]
    Mar 15, 2004 - Creating a Popup Date Picker
    Conrad Jalali shows how to extend the functionality of the ASP.NET Calendar control to remove some of the annoying postback delays that occur when populating a text box with a date from a popup calendar.
    [Read This Article]  [Top]
    Oct 23, 2003 - Creating a Custom .NET Web Control With Events
    This article covers some of the essentials of building reusable Web controls. Learn how to create a Web control and its custom events and event arguments, as well as how to use the control properly within a page.
    [Read This Article]  [Top]
    Aug 12, 2003 - Creating a Generic Pager Control
    ASP.NET provides only one control that supports paging, the DataGrid. Tomasz Kaszuba shows how to build and implement a custom pager for different controls that change depending on the data source or presentation.
    [Read This Article]  [Top]
    Jun 10, 2003 - Hosting .NET Windows Forms Controls in IE
    Windows Forms within Web pages work in a manner similar to Java applets. Thiru Thangarathinam shows how to host Windows Forms controls in Internet Explorer and how to utilize .NET Code Access Security to configure what the control can do when running within the browser.
    [Read This Article]  [Top]
    May 6, 2003 - Building a Simple Mask Control
    James Culshaw shares his experiences building his first working custom control, a basic mask control that allows input of time values, and offers advice and tips to those just starting out.
    [Read This Article]  [Top]
    Mar 3, 2003 - Creating a Server Control for JavaScript Testing
    Learn how to create an ASP.NET server control that detects if a browser supports JavaScript AND if JavaScript is enabled.
    [Read This Article]  [Top]
    Jan 21, 2003 - Protecting Users from Suspect Textual Data
    Learn the ins and outs of composite controls by creating an application that prevents users from submitting offending text.
    [Read This Article]  [Top]
    Nov 26, 2002 - Introduction to the .NET Speech SDK
    Rob Chartier offers a tour of the .NET Speech SDK Beta 2 and its use of the industry specification SALT. The article shows you how to create a basic speech-enabled Web user control.
    [Read This Article]  [Top]
    Aug 27, 2002 - Creating "Self Populating" Controls
    In this article, Luther Stanton shows how to combine inheritance and server controls to create a self-populating drop-down-list control.
    [Read This Article]  [Top]
    Mailing List
    Want to receive email when the next article is published? Just Click Here to sign up.

    Support the Active Server Industry

    internet.commediabistro.comJusttechjobs.comGraphics.com

    Search:

    WebMediaBrands Corporate Info

    Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
    Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs