473,623 Members | 3,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Commmon handling of Calendar controls

P K
I have around 20 calendar controls on my screen besides 20 textboxes.
The functionality of each control is the same, they take in a parameter for
the textbox name and open a calendar in a popup. And on selection the
textbox -identified by the name passed in the querystring , is populated.

Now, the 20 controls will have 20 event handlers. Is there a way I can have
one function (or event handler ) which would handle all the 20 calls.
What I mean is that instead of having different event handlers for each
calendar control, can I have just one for each of them ? And based on the
parameter passed I would identify the textbox?
Nov 19 '05 #1
1 1168
Use any of the following options:
1- Declaratively:
<asp:Calendar ID="calender1" Runat="server"
OnSelectionChan ged="Calenders_ SelectionChange d"></asp:Calendar>
<asp:Calendar ID="calender2" Runat="server"
OnSelectionChan ged="Calenders_ SelectionChange d"></asp:Calendar>

and so on..

2- in the code behind, add statements in the Page.Init eventhandler:

a. For C#,
this.calender1. SelectionChange d += new
System.EventHan dler(this.Calen ders_SelectionC hanged);
this.calender2. SelectionChange d += new
System.EventHan dler(this.Calen ders_SelectionC hanged);

b. For VB:
AddEventHandler calender1.Selec tionChanged , AddressOf
Calenders_Selec tionChanged

or
Private sub Calenders_Selec tionChanged(sen der as object, e as EventArgs )
handles calender1.Selec tionChanged , calender2.Selec tionChanged

In the method that handles the event:
private void Calenders_Selec tionChanged(obj ect sender, System.EventArg s e)
{
switch (((Calendar)sen der).ID)
{
case "calender1" : //process calender1
break;
case "calender2" : //process calender2
break;
}
}
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"P K" wrote:
I have around 20 calendar controls on my screen besides 20 textboxes.
The functionality of each control is the same, they take in a parameter for
the textbox name and open a calendar in a popup. And on selection the
textbox -identified by the name passed in the querystring , is populated.

Now, the 20 controls will have 20 event handlers. Is there a way I can have
one function (or event handler ) which would handle all the 20 calls.
What I mean is that instead of having different event handlers for each
calendar control, can I have just one for each of them ? And based on the
parameter passed I would identify the textbox?

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2745
by: TDIOwa | last post by:
I have a form that has a specific date on it. I want to open another form that has the Active Control Calendar on it. I want to open this form to the specific date on the first form. I have searched this forum high and low to find a solution and have tried virtually everything mentioned, all to no avail. Some solutions even crash the computer. Does anyone have any ideas? Thanks TD
5
4316
by: Charles | last post by:
Hello, I would like for my users to have a calendar control only when needed. IE button click for the control to appear and then once the date is selected. Populate a text box and the calendar control then is invisible. How do I make the calendar control pop up over other control in a asp.net c# environment? Charles
2
1802
by: luca | last post by:
I'm trying to build a Server Control, it's a calendar to manage sellers appointments (don't answer me to use and custumize Calendar Control because unluckily it's not possible for this specific project). A piece of my control's interface is composed of a table and in each of its cells are stored informations about a seller, a date and a time range. Each of these cells has to be an interactive element: I should be able to process datas...
2
3634
by: Chuck Hartman | last post by:
I've been trying to add an ImageButton object to a Calendar table cell, but so far I am unable to handle the Command event from that button in my form's code behind. Below is an example of what I am trying to do. The ImageButton that is on the form handles its Command event just fine, but the ImageButton that is added to the cell does not handle the event. Am I doing something wrong, or is not possible to add server controls to a calendar...
2
3407
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many controls (i.e. roundedcorners component www.4guysfromrolla.com], buttons and panels) functions like a tab control. The buttons are programmatically designed to make the corresponding panel visible. Sample aspx.vb code:
27
2688
by: Dino M. Buljubasic | last post by:
I'd like to build a calendar displaying all days in a month in a grid so that when I click on the header of a square representing a day of month, I can add a new meeting etc. I know that .net provides a calendar control but that one is not what I want. I want my callendar to fill whole form and display only one month. I would like to build someting like this: +---------------+ | 8__________| cell header, shows day, clicking on it...
2
1832
by: Mariano Padilla | last post by:
The calendar control only has the event of SelectionChanged to detect if the user clicks on the calendar. I have 2 calendars on a form, one for arrival date one for departure date. Every time a use clicks on the calendars, the proper date gets filled in the text boxes below the calendars. I noticed that if you click on the date correspinding to the current date, the textboxes do not get filled or changed. Is this a bug? If not how can...
2
3761
by: jodyblau | last post by:
I am trying use a Calendar Control 10.0 in one of my forms. (I am using access 2002) What I want to do is have the user click a button which makes the calendar visible. Then when the user clicks on a date, it sends it to a text box and then the calendar should disappear. All of the examples I have been able to track down seem to use events that aren't available to me. Most notably, any click events.
7
6237
by: Vincent | last post by:
Does anyone know of any good 3rd party calendar controls that can be used in VBA? I am trying to find a calendar control that will allow you to select multiple dates at once or a range of dates, such as a week or month. Thanks.
0
8221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8162
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8662
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8603
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5560
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1468
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.