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?