I am trying to use jQuery with a GridView but having trouble making it work. The markup for a gridView looks as follows (abbreviated version):
<asp:TemplateField HeaderText="Start Date">
<asp:Button runat="server" ID="btnShowCalendar" CssClass="CalendarDiv" onClientClick="return false" Text="..." />
<asp:Calendar id="calStartDate" OnSelectionChanged="calDate_SelectionChanged" Runat="server" />
Similiar code has been applied to several other date type columns
my jQuery looks something like the following:
alert( this.id );
What I am trying to accomplish is to set the visiblity of the div tag on/off when a user clicks on the button inside the EditItemTemplate. Problem is that this function is being called multiple times. The more records I have, the more times this function is called. Makes sense as I have many buttons that has the "CalendarDiv" class applied to them. How can I make this function call only once?