Showing posts with label wse3. Show all posts
Showing posts with label wse3. Show all posts

Wednesday, March 21, 2012

CalendarExtender not working

Hello.

I'm developing a web site in VS2005 Pro, Sp1, ASP2.0, WSE3.0, SQLServer Express 2005 on XP Pro, SP2.

I'm attempting to use the CalendarExtender from the AJAX Control Toolkit. My code showing the extender and the text box it is tied is below.

When i run the program, it does not popup a calendar when the text box get focus. It just functions as a normal textbox.

Is there another property i should set?

It seems pretty simple. Just assign the id of the text box to the TargetControlID of the extender.

Any help would be gratefully appreciated.

Thanks,
Tony

Sorry. I forgot this:

<%@.PageLanguage="VB"MasterPageFile="~/AppMaster.Master"CodeFile="GetTruckMileage.aspx.vb"Inherits="GetTruckMileage"title="Coyne Web Services - Get Truck Mileage" %>

<%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<%@.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Namespace="System.Web.UI"TagPrefix="asp" %>

<asp:ContentID="Content1"ContentPlaceHolderID="mainCopy"runat="server">

<divclass="container">

<h1>Coyne Chemical Trips and Truck Mileage</h1>

<pclass="teaser">Coyne Chemical Trips and Truck Mileage from Xatanet.</p>

<br/>

<asp:LabelID="Label1"runat="server"Text="Start Date:"></asp:Label>
<asp:TextBoxID="startDateCalendar"runat="server"></asp:TextBox>

<br/>
<br/>

<asp:LabelID="Label2"runat="server"Text=" End Date:"></asp:Label>
<asp:TextBoxID="endDateCalendar"runat="server"></asp:TextBox>
<asp:ScriptManagerid="ScriptManager1"runat="server">
</asp:ScriptManager>

<cc1:CalendarExtenderID="startDateCalendarExtender"runat="server"TargetControlID="startDateCalendar">
</cc1:CalendarExtender>

<cc1:CalendarExtenderID="endDateCalendarExtender"runat="server"TargetControlID="endDateCalendar">
</cc1:CalendarExtender>

<div>

<br/>
<br/>

<asp:ButtonID="getTruckMileageButton"Text="Get Truck Mileage"runat="server"/> 
<asp:ButtonID="exportTripsButton"runat="server"Text="Export to HP3000"/> 

<br/>
<br/>

<asp:TextboxID="getTruckMileageCompletedTextbox"runat="server"ReadOnly="True"style="overflow: visible"TextMode="MultiLine"Width="360px"></asp:Textbox>

</div>

</div>


try putting the scriptmanager before the textboxes, as good practice you should always put it at the top of a page, ( i think i heard that somewhere :P)


Hello Cowboy.

That did not help.

Why do things look so simple and easy in demos and when other people use them. When i try something, it never works the way it is supposed to.

Maybe i don't know how to set up a development computer. Have other programmers run into this problem with the calendarextender?

Thanks,
Tony


i just did this and it works fine

<head runat="server"> <title>Untitled Page</title></head><body><form id="muy" runat="server"><div class="container"><h1>Coyne Chemical Trips and Truck Mileage</h1><p class="teaser">Coyne Chemical Trips and Truck Mileage from Xatanet.</p><br /><asp:Label ID="Label1" runat="server" Text="Start Date:"></asp:Label><asp:TextBox ID="startDateCalendar" runat="server" ></asp:TextBox>  <br /><br /> <asp:Label ID="Label2" runat="server" Text=" End Date:"></asp:Label><asp:TextBox ID="endDateCalendar" runat="server"></asp:TextBox><asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager><cc1:CalendarExtender ID="startDateCalendarExtender" runat="server" TargetControlID="startDateCalendar"></cc1:CalendarExtender><cc1:CalendarExtender ID="endDateCalendarExtender" runat="server" TargetControlID="endDateCalendar"></cc1:CalendarExtender><div><br /><br /><asp:Button ID="getTruckMileageButton" Text="Get Truck Mileage" runat="server" />         <asp:Button ID="exportTripsButton" runat="server" Text="Export to HP3000" />  <br /><br /><asp:Textbox ID="getTruckMileageCompletedTextbox" runat="server" ReadOnly="True" style="overflow: visible" TextMode="MultiLine" Width="360px"></asp:Textbox></div> </div> </form></body></html>
i think there is an issue with how you have it in your container dealy

Well then. I must be pretty stupid.

If my code works for you, then there must be something seriously wrong with my computer. I could try it on other computers, but that requires more effort than the benefit i would realize. To me it's not worth it to go through a bunch of troubleshooting steps just to have a nice little popup for a date entry. I'm sure there are a lot of other troubleshooting steps too.

I can't figure it out. I guess that's the end of my attempts to put AJAX control toolkit to use.

Thanks,
Tony


i wouldnt give up on the toolkit just yet, it has great features, try to put the code i posted above in a new page and see if it works, there could be a compatibility issue because you were putting the controls inside a container of some kind (i forget how u had it set up) but the code i posted put it right on the form. Try it like that and see if the calendar works, then you will know if its an issue with the container (in which case you can find another way to hold the contorls, like a panel) or if its actually you computer. Usually if you have an issue with your computer you would see an error tho


I tried your code in another project and it worked ok.

So there is something in my project that is keeping it from working.

Thanks,
Tony


I think its a probelm with this

<asp:ContentID="Content1"ContentPlaceHolderID="mainCopy"runat="server">

ive never used this control so im not sure what is going on, but maybe try using a different control then this if u can.


I don't think i can use a different control. That control is tied to the master page.

I didn't see any warnings or notes in AJAX saying that it would not work with master pages and in fact, if AJAX is not compatible with master pages, then i can't use it anyway, because all of my projects use master pages.

Thanks,
Tony


ajax works with masterpages, it just takes a little effort from what ive heard. another option though is just using the standard asp.net calendar and putting it in its own <div> and using hide/show to make it display and use the selecteddate event to add the date they pic to your textbox. note a nice looking as ajax calendar with animation and stuff, but it gets the job done


Hello Cowboy.

I figured what the problem is. I should have watched this video before i started using AJAX.

I alao should have informed you that i was adding to an existing application.

Thanks for your help.
Tony

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=81

How Do I: Add ASP.NET AJAX Features to an Existing Web Application?