Calendar control is not popping-up when clicked on image - asp.net

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?

how many row do you have in grid? also probably you have more than one image with such id

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.

Related

move focus to another asp.net control after ajax toolkit calendar extender selection

I am having trouble finding an answer to this problem.
What I am trying to do is this;
I have an asp.net (aspx) page that has two text boxes on it (among other controls) that have an Ajax Toolkit Calendar Extender on them. The first text box get focus and the calendar control appears and I am able to select a date just fine.
Here is my problem. After the date is selected for the first text box with the calendar control I want the second text box to automatically have the same date entered into it and the focus moved to a button (btnSearch) not the second text box.
I am using VB in code behind. I must not be wording my searches correctly because I can't seem to find anything close to solving this.
Does anyone have any ideas as to how this can be done? I am open to using JQuery if I have to but would prefer not to.
Thanks for any help in advance.
Note: There is no code to show because I can't find anything to try.
Update:
Here is the html I have:
<asp:TextBox runat="server" ID="txbDateStart" CssClass="form-control input-lg" ReadOnly="true" Visible="false" OnTextChanged="txbDateStart_TextChanged"/>
<cc1:CalendarExtender ID="CalendarExtender1" PopupButtonID="imgPopup" runat="server" TargetControlID="txbDateStart" Format="MM/dd/yyyy" PopupPosition="Right" />
<asp:TextBox runat="server" ID="txbDateEnd" CssClass="form-control input-lg" Visible="false" ToolTip="Click to change End Date" ReadOnly="true" />
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txbDateEnd" Format="MM/dd/yyyy" />

how to create pop up window with hyperlink in asp

I am trying to create a popup window when clicked the hyperlink. Currently, my hyperlink is opening the entire page which is huge and i would like to make like a pop up, smaller size. How can i do that?
Here is my code:
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("ID", "~/DET/Policy.Merket?ID={0}") %>' Target="_blank">POLICY</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
i come back just to post the solution in case someone needs:
`<asp:Hyperlink Runat="server" NavigateUrl='<%# Eval("ID", "~/DET/Policy.Merket?ID={0}") %>' onclick="window.open (this.href, 'popupwindow', 'width=400,height=400,scrollbars,resizable'); return false;">Link text goes here<asp:Hyperlink>`
You could use the javascript window.open() function in a pure HTML button. Copying from here, you can see an example defining the popup window size etc.
Link text
Another alternative would be to use jQuery and specifically the overlay tool.
Hope I helped!
use the ajaxtoolkit modalpopup
it will much more helpfull for you
thanks,

AjaxControlToolkit Calendar postioning relative to popup image and not the textbox

Hi I am using an AjaxControlToolkit Calander control. But as per my requirements I have to split the selected date into separate textboxes for date month and year. So I have used a textbox say "textbox1" which have an popupimage button for the ajax control calander.
I make the textBox1 hidden with css and have autopostback set to true. On the text change event I split the date string and put it in separate textboxes as desired.
Everything is working fine except for the positioning of the Calander control. When I hide the main textbox control the calander positions itself on the top left side of the screen and not near the popimage. How can I fix that.
It will surely have an abnormal behavior if you try to attach a calendar control on a hidden TextBox. Instead of hiding the textbox, make it look like hidden but not literally hidden.
for example
<asp:TextBox ID="textBox1" runat="server" style="border:0 none Transparent;margin:0;width:0;background-color:Transparent" ReadOnly="true" />
Thanks to the answer above just a slight modification is needed to make it the correct answer.
<asp:TextBox ID="textBox1" runat="server" style="border:0 none Transparent;margin:0;width:0;background-color:Transparent" />

AjaxControlToolkit CalendarExtender Control not working in my website

I' using the AjaxControlToolkit CalendarExtender in my web site but after uploading it does how show the calendar control. I have registered the control on the page itself. The page postback when I click the image on which I applied the control.
What can be the reason of this?
Check whether you added ToolkitscriptManager in your page, which is in AjaxToolkit
If you are using an ImageButton to show the calendar,
then use ajax control toolkit and put these controls
<asp:ToolkitScriptManager runat="server" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="calIcon.jpg" />
<asp:CalendarExtender ID="CalendarExtender1" TargetControlID="TextBox1"
PopupButtonID="ImageButton1" runat="server">
</asp:CalendarExtender>
If you are still getting the page postback when clicking the ImageButton, you can add onClientClick='return false;' to the imageButton
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="calIcon.jpg"
OnClientClick="return false;" />
Drag and place Script manager at top of the ajax control or at top of the form.
As you said that ajax calender works fine on local but when you uploaded it it started creating problems following are the workarounds give them a try.
Check that whether you uploaded the ajax toolkit dll on the server or not.
secondly make sure that you uploaded updated web.config file.
let me know if its helpful otherwise i will try finding other workarounds

ASP.NET [Date Input]

How to make some Date input control like a texbox.
I need start date and end date and count period and make a database select.
But if I put 2 Calendars on my page that will be looking like wierd :-/
So I want to know how to make some dateinput masks for textboxes or some else solution.
The AjaxControlToolkit offers a couple of ways to do this. Probably the one you want is the CalendarExtender which you attach to a TextBox control, and which displays a clickable calendar when the textbox gets the focus, e.g. this markup:
<asp:ScriptManager runat="server" ID="ScriptManager" />
<asp:TextBox runat="server" ID="TextBox1"></asp:TextBox>
<ajaxtoolkit:CalendarExtender runat="server" ID="MyCalendar" TargetControlID="TextBox1" />
produces this in the browser when the textbox is clicked on:
alt text http://www.philippursglove.com/stackoverflow/calendarextender.png
There's also a DatePicker in JQuery UI that does something similar.
Another extender to look at is the MaskedEditExtender which allows you to limit your user's input so that they can only enter valid dates in a TextBox.

Resources