Calendar control is not popping-up when clicked on image

我是研究僧i 提交于 2020-01-05 08:11:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!