5,316,172 members and growing! (18,609 online)
Email Password   helpLost your password?
Web Development » ASP.NET Controls » General     Beginner License: The Apache License, Version 2.0

DayPilot MonthPicker for ASP.NET

By Dan Letecky

A light-weight month picker that will save you an hour or two.
C#, .NET, ASP.NET, Dev

Posted: 15 May 2008
Updated: 15 May 2008
Views: 3,285
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
5 votes for this Article.
Popularity: 2.86 Rating: 4.09 out of 5
1 vote, 20.0%
1
0 votes, 0.0%
2
1 vote, 20.0%
3
0 votes, 0.0%
4
3 votes, 60.0%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article


A few numbers for the beginning

What it replaces

It replaces a combination of two separate dropdowns (one for month, another for year).

Typical usage

On reporting pages for listing values/summaries for a given time period.

How it saves your time

  • It generates the month list automatically.
  • It generates the year list automatically from the YearStart and YearEnd properties.
  • It automatically uses the language of current culture.
  • You can use directly to fill parameters of SqlDataSource (the selected month is accessible as both StartDate and EndDate properties).
  • It automatically preselects the current month.
  • Compatible with UpdatePanel.

Sample 1: Switching the language

You have two options for choosing the language:

1. Change the Culture in your Page declaration:

<%@ Page Language="C#" … Culture="en-US" %>
2. Set the Culture property of MonthPicker control:
MonthPicker1.Culture = "en-US";

Sample 2: SqlDataSource and GridView integration

DayPilot MonthPicker can be used directly in SqlDataSource declaration:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:MonthPicker %>" 
SelectCommand="SELECT [Id], [Name], [Start] FROM [events] WHERE ([Start] >= @Start) AND ([Start] < @End)"> 
    <SelectParameters> 
        <asp:ControlParameter 
    ControlID="MonthPicker1" PropertyName="StartDate"
            Name="Start" Type="DateTime" /> 
        <asp:ControlParameter 
        ControlID="MonthPicker1" PropertyName="EndDate"
            Name="End" Type="DateTime" /> 
    </SelectParameters> 
</asp:SqlDataSource> 

Links

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0

About the Author

Dan Letecky


My open-source ASP.NET 2.0 controls:

DayPilot - Outlook-like calendar/scheduling control
DayPilot MonthPicker - Light-weight month picker
MenuPilot - Hover context menu

Location: Czech Republic Czech Republic

Other popular ASP.NET Controls articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
  (Refresh) 
Subject  Author Date 
-- There are no messages in this forum --

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 15 May 2008
Editor:
Copyright 2008 by Dan Letecky
Everything else Copyright © CodeProject, 1999-2008
Web09 | Advertise on the Code Project