问题
I'm using a CalendarExtender
control with the help of <img>
to populate a TextBox
with a date. I am using this in EditItemTemplate
of GridView
. But when I click on the image, the calendar control is not poping up.
I have used this CalendarExtender
control in four or five other places (in this project) also. Everywhere else it is working fine. I have compared the code from the well working version to this code. No difference at all.
I have written the code like below:
<EditItemTemplate>
<asp:TextBox ID="txtDateDelivered" runat="server"
Text='<%# Bind("DateDelivered","{0:dd/MM/yy}") %>'
CssClass="DateTextBoxInGridView" >
</asp:TextBox>
<asp:CalendarExtender ID="calexDateDelivered" runat="server"
Format="dd/MM/yy"
TargetControlID="txtDateDelivered"
PopupButtonID="calDateDelivered">
</asp:CalendarExtender>
<img src="Images/calendar.gif"
id="calDateDelivered"
alt="Calendar" />
</EditItemTemplate>
Can anybody please tell where could be the problem?
回答1:
how many row do you have in grid? also probably you have more than one image with such id
回答2:
The image tag which you have used is not a server control. It is simple html control, this is the reason why the calender control does not reconise this image control..
Try using asp.net image button over here instead of . It should work then.
cheers....
Rahul C.
来源:https://stackoverflow.com/questions/7467362/calendar-control-is-not-popping-up-when-clicked-on-image