473,378 Members | 1,140 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to Make Customise Calender Control In Asp.net2.0

16
Pls Any One Give Me Ans


I want to Make Customise calender Control in Asp.net2.0 with the Help of C#.
and I want to increse ind Decrease Year By Particular Tab.


Regards & Thanks

Atul singh
Jul 26 '07 #1
2 3863
gchq
96
This is how to do it in VB - I'll leave it to you to convert

aspx page (with dropdownlists added)

Expand|Select|Wrap|Line Numbers
  1.  
  2. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="PlanCalendar.aspx.vb" Inherits="Test_PlanCalendar" %>
  3.  
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5.  
  6. <html xmlns="http://www.w3.org/1999/xhtml" >
  7. <head runat="server">
  8.     <title>Untitled Page</title>
  9. </head>
  10. <body>
  11.     <form id="form1" runat="server">
  12.     <div>
  13.         &nbsp;<asp:Panel ID="Panel1" runat="server" BackColor="#E0E0E0" BorderStyle="Ridge"
  14.             Height="130px" HorizontalAlign="Center" Width="361px">
  15.         <table style="width: 351px">
  16.             <tr>
  17.                 <td colspan="3">
  18.                 </td>
  19.             </tr>
  20.             <tr>
  21.                 <td>
  22.                     <asp:DropDownList ID="drpCalMonth" runat="server" AutoPostBack="True">
  23.                     </asp:DropDownList></td>
  24.                 <td>
  25.                     </td>
  26.                 <td style="text-align: right">
  27.                     <asp:DropDownList ID="drpCalYear" runat="server" AutoPostBack="True">
  28.                     </asp:DropDownList></td>
  29.             </tr>
  30.             <tr>
  31.                 <td colspan="3">
  32.                     &nbsp;<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="White" BorderWidth="1px" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="190px" NextPrevFormat="FullMonth" Width="350px">
  33.                         <SelectedDayStyle BackColor="#333399" ForeColor="White" />
  34.                         <TodayDayStyle BackColor="#CCCCCC" />
  35.                         <OtherMonthDayStyle ForeColor="#999999" />
  36.                         <NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" VerticalAlign="Bottom" />
  37.                         <DayHeaderStyle Font-Bold="True" Font-Size="8pt" />
  38.                         <TitleStyle BackColor="White" BorderColor="Black" BorderWidth="4px" Font-Bold="True"
  39.                             Font-Size="12pt" ForeColor="#333399" />
  40.                     </asp:Calendar>
  41.                 </td>
  42.             </tr>
  43.         </table>
  44.         </asp:Panel>
  45.  
  46.     </div>
  47.     </form>
  48. </body>
  49. </html>
  50.  
Code Behind

Expand|Select|Wrap|Line Numbers
  1.  
  2. Partial Class Test_PlanCalendar
  3.     Inherits System.Web.UI.Page
  4.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  5.         If Not Page.IsPostBack Then
  6.             Call Populate_MonthList()
  7.  
  8.             Call Populate_YearList()
  9.         End If
  10.  
  11.     End Sub
  12.  
  13.     Sub Set_Calendar(ByVal Sender As Object, ByVal E As EventArgs)
  14.  
  15.         'Whenever month or year selection changes display the calendar for that month/year        
  16.         Calendar1.TodaysDate = CDate(drpCalMonth.SelectedItem.Value & " 1, " & drpCalYear.SelectedItem.Value)
  17.  
  18.     End Sub
  19.  
  20.     Sub Populate_MonthList()
  21.         'Add each month to the list
  22.         drpCalMonth.Items.Add("January")
  23.         drpCalMonth.Items.Add("February")
  24.         drpCalMonth.Items.Add("March")
  25.         drpCalMonth.Items.Add("April")
  26.         drpCalMonth.Items.Add("May")
  27.         drpCalMonth.Items.Add("June")
  28.         drpCalMonth.Items.Add("July")
  29.         drpCalMonth.Items.Add("August")
  30.         drpCalMonth.Items.Add("September")
  31.         drpCalMonth.Items.Add("October")
  32.         drpCalMonth.Items.Add("November")
  33.         drpCalMonth.Items.Add("December")
  34.  
  35.  
  36.         'Make the current month selected item in the list
  37.         drpCalMonth.Items.FindByValue(MonthName(DateTime.Now.Month)).Selected = True
  38.     End Sub
  39.  
  40.  
  41.     Sub Populate_YearList()
  42.         Dim intYear As Integer
  43.  
  44.         'Year list can be changed by changing the lower and upper 
  45.         'limits of the For statement    
  46.         For intYear = DateTime.Now.Year - 20 To DateTime.Now.Year + 20
  47.             drpCalYear.Items.Add(intYear)
  48.         Next
  49.  
  50.         'Make the current year selected item in the list
  51.         drpCalYear.Items.FindByValue(DateTime.Now.Year).Selected = True
  52.     End Sub
  53.  
Jul 27 '07 #2
Frinavale
9,735 Expert Mod 8TB
I have moved your question to the .NET forum. The .NET Articles section is reserved for articles that are purely informational; like "how-tos" etc. The .NET Forum is the place for your questions. In the future please post your questions here (Blue Menu Along the Top: Forums->.NET).

Thanks

-Frinny
Jul 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: PerryC | last post by:
I want to be able to accomplish this, please help: When click on the DOB field, a ActiveX Calender popup and the user choose a date, the value is automatically refreshed in the DOB field in the...
0
by: Steve Peterson | last post by:
Hi I have a web app running on WinXP Pro which has the OS's operating system's regional settings set to "Spanish - Spain". I have a web app running on this computer that one page has a calender...
4
by: Chris | last post by:
Hi, I am trying to create a popup calender so a user can click on a button on the main form, a calender will then popup, the user will select a date and then click ok on the popup. The date will...
1
by: Kay | last post by:
Hi all, I'm trying to create an app to allow user to roster staff. My plan is to have a list of people in a listview on the left then a "calender look" control on the right, which will display...
5
by: Tsair | last post by:
I do a customise DataGridColumn with a UserControl (TextBox + Button for Calender), DataGridView does not show the data content of the column.
1
by: Doug | last post by:
Hi, How do I get a Calender Control popup to appear near the button which activated it, rather than on the other side of the screen? (MS Access 2000)
0
by: raghulvarma | last post by:
I am developing a web page using c# as my code behind. I need to have a java script for a calender control.I know how to use the calender control which is seen in the tool bar. But I don't need that...
8
by: Greg (codepug | last post by:
For lack of the proper expression, how do I excite a control to cause events to trigger. I have a date control and am using a calender form button to fill the text box with the date. The text box...
21
Vkas
by: Vkas | last post by:
i had created my own web calender control!!!! it consist 1} text box (it display's the selected date) 2} button (it hide and show the calender control) 3} calender control (use for the selection...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.