I have a textbox, an image button and a calendar extender on my form. If I go with the default and don't make an entry for the PopupControlID attribute, the calendar gets displayed when the textbox gets focus and I can select a date from it. If I use the image button as the entry for the PopupControlID attribute, the calendar initially gets displayed but then the whole page posts to the server and returns before a date can be selected. There aren't any AJAX controls on the MasterPage and nothing in it's code-behind that would cause this issue. There also isn't currently any code-behind in my form ... just HTML ... and I'm posting it in its entirety below:
<%@dotnet.itags.org.PageLanguage="VB"MasterPageFile="~/MasterPages/MasterPage.master"AutoEventWireup="false"CodeFile="CalendarTest.aspx.vb"Inherits="Correspondence_CalendarTest"title="Untitled Page" %>
<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>
<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">
<asp:ScriptManagerrunat="server"></asp:ScriptManager>
<br/><br/>
<asp:TextBoxID="Date1"runat="server"></asp:TextBox>
<asp:ImageButtonID="ImageButton1"runat="server"ImageUrl="~/Images/Calendar_scheduleHS.png"/>
<cc1:CalendarExtenderID="CalendarExtender1"runat="server"TargetControlID="Date1"PopupButtonID="ImageButton1">
<%--
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="Date1">
--%>
</cc1:CalendarExtender>
</asp:Content>
Why does this bloody thing insist on posting back to the server and is there anything I can do to prevent it from occurring?
TIA,
Allen
this is from another issue close to what you have because when you click the button a second time it does a post back as well. there is the solution from another post.
just to say, I've found this can be solved by creating a plain html img tag and assigning the popubbutton id to that instead of an asp imagebutton control
Did you make sure the CAUSESVALIDATION property of the Calendarextender is set to false? There is no problem using an asp:imagebutton control if you have that done. I mean that way when the Calendar control is clicked, all that happens is the control opens and selection is made.
Dollarjunkie
1 comment:
Hi there I am displaying the CalendarExtender dynamically on my page using the following code:
tCell = New TableCell
tCell.Width = "100"
txtFrequencyDrawDate = New TextBox
txtFrequencyDrawDate.ID = "txtNewDate^" & strFrequency
txtFrequencyDrawDate.Visible = False
txtFrequencyDrawDate.Width = "80"
tCell.Controls.Add(txtFrequencyDrawDate)
imgbtnCal = New ImageButton
imgbtnCal.ID = "imgbtnNewCal^" & strFrequency
imgbtnCal.ImageUrl = "~/Images/cal.gif"
imgbtnCal.Visible = False
imgbtnCal.OnClientClick = "return false;"
imgbtnCal.CausesValidation = False
tCell.Controls.Add(imgbtnCal)
calext = New AjaxControlToolkit.CalendarExtender
calext.ID = "calextNew^" & strFrequency
calext.PopupButtonID = "imgbtnNewCal^" & strFrequency
calext.TargetControlID = "txtNewDate^" & strFrequency
calext.Enabled = True
tCell.Controls.Add(calext)
tRow.Controls.Add(tCell)
Still when I push the image button nothing happens...
Any thoughts????
Post a Comment