Click here to Skip to main content
Licence Apache
First Posted 15 May 2008
Views 17,983
Downloads 82
Bookmarked 30 times

DayPilot MonthPicker for ASP.NET

By Dan Letecky | 15 May 2008
A light-weight month picker that will save you an hour or two
1 vote, 12.5%
1

2
1 vote, 12.5%
3

4
6 votes, 75.0%
5
4.33/5 - 8 votes
μ 4.33, σa 2.60 [?]

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

History

  • 15th May, 2008: Initial post

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



Czech Republic Czech Republic

Member
My open-source ASP.NET 2.0 controls:
 
DayPilot - Outlook-like calendar/scheduling control
DayPilot MonthPicker - Light-weight month picker
MenuPilot - Hover context menu

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
NewsSource code available online PinmemberGilad Khen17:46 30 May '09  
GeneralLovely Pinmemberpeter gabris8:54 9 Sep '08  
GeneralRe: Lovely PinmemberDan Letecky7:40 12 Sep '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.5.120210.1 | Last Updated 15 May 2008
Article Copyright 2008 by Dan Letecky
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid