Click here to Skip to main content
13,512,710 members
Click here to Skip to main content
Add your own
alternative version


34 bookmarked
Posted 15 May 2008

DayPilot MonthPicker for ASP.NET

, 15 May 2008
Rate this:
Please Sign up or sign in to vote.
A light-weight month picker that will save you an hour or two

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 it 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)"> 

    ControlID="MonthPicker1" PropertyName="StartDate"

            Name="Start" Type="DateTime" /> 

        ControlID="MonthPicker1" PropertyName="EndDate"

            Name="End" Type="DateTime" /> 



  • 15th May, 2008: Initial post


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


About the Author

Dan Letecky
Czech Republic Czech Republic

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
manoj kumar choubey16-Feb-12 0:42
membermanoj kumar choubey16-Feb-12 0:42 
NewsSource code available online Pin
Gilad Khen30-May-09 16:46
memberGilad Khen30-May-09 16:46 
GeneralLovely Pin
peter gabris9-Sep-08 7:54
memberpeter gabris9-Sep-08 7:54 
GeneralRe: Lovely Pin
Dan Letecky12-Sep-08 6:40
memberDan Letecky12-Sep-08 6:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180417.1 | Last Updated 15 May 2008
Article Copyright 2008 by Dan Letecky
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid