Use any of the following options:
1- Declaratively:
<asp:Calendar ID="calender1" Runat="server"
OnSelectionChanged="Calenders_SelectionChanged"></asp:Calendar>
<asp:Calendar ID="calender2" Runat="server"
OnSelectionChanged="Calenders_SelectionChanged"></asp:Calendar>
and so on..
2- in the code behind, add statements in the Page.Init eventhandler:
a. For C#,
this.calender1.SelectionChanged += new
System.EventHandler(this.Calenders_SelectionChange d);
this.calender2.SelectionChanged += new
System.EventHandler(this.Calenders_SelectionChange d);
b. For VB:
AddEventHandler calender1.SelectionChanged , AddressOf
Calenders_SelectionChanged
or
Private sub Calenders_SelectionChanged(sender as object, e as EventArgs )
handles calender1.SelectionChanged , calender2.SelectionChanged
In the method that handles the event:
private void Calenders_SelectionChanged(object sender, System.EventArgs e)
{
switch (((Calendar)sender).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?