Solved

Getting AJAX Calendar to work with visual studio

Posted on 2009-04-03
5
1,767 Views
Last Modified: 2013-12-17
Hello,

I am trying to use AJAX with my cSharp lab. I have downloaded all the AJAX stuff necessary and have created an AJAX enabled website. Right now I am trying to get the calendar to work and I am receiving the following error:

The TargetControlID of 'CalendarExtender1' is not valid. The value cannot be null or empty.

I will be asking a whole lot of questions for a while this is like question 1 out of 100.

Here is my code below.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddUser.aspx.cs" Inherits="AddUser" %>
 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="Ajax" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <h1>Sign up to NAITBook</h1>
    <form id="Form1" method="post" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <table>
            <tr><td>First Name:</td>
                <td><asp:TextBox Runat="server" ID="txtUsername" /></td></tr>
            <tr><td>Last Name:</td>
                <td><asp:TextBox Runat="server" ID="TextBox1" /></td></tr>   
            <tr><td>Gender:</td>    
                <asp:DropDownList ID="ddlGender" runat="server">
                </asp:DropDownList></tr>  
            <tr><td>Date of Birth:</td>   
                <Ajax:CalendarExtender ID="CalendarExtender1" runat="server">
                    </Ajax:CalendarExtender>
                </tr>
            <tr><td>Password:</td>
                <td><asp:TextBox Runat="server" ID="txtPassword" TextMode="Password"  /></td></tr>
            <tr><td><asp:Button ID="btnSumbit" runat="server" Text="Sumbit" /></td></tr>
        </table>
    </form>
    <div style='color:red'>
        <asp:Literal Runat="server" ID="lblMessage" />
    </div>
</body>
</html>

Open in new window

0
Comment
Question by:tqrecords
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:mrcoolcoder
ID: 24065961
The Calender extender needs a textbox to hold the date value, so you need to add a date textbox.  Lets call it "DOBTextbox" and then you need to add "TargetControlID = 'DOBTextbox'  ".  Once you do that, your textbox will now be associated with the Calender extender.  

Don't forget your script manager at the top of the page.
0
 

Author Comment

by:tqrecords
ID: 24069725
cool, is there also a way to make the default go to the year selection when you click on it??
0
 
LVL 5

Expert Comment

by:mrcoolcoder
ID: 24070077
Try this:
http://forums.asp.net/t/1187558.aspx

If needed, you could actually change some of the controls JavaScript but I have not had the pleasure of doing that.
0
 

Author Comment

by:tqrecords
ID: 24070091
hmm its a little more complicated than I thought.

Never mind that. Would you know how to take the date of birth selected from the calender then change that to their age and put the integer value in the textbox?
0
 
LVL 5

Accepted Solution

by:
mrcoolcoder earned 500 total points
ID: 24070125
Look at tip #6, you will have to override the calculation using JavaScript
http://www.dotnetcurry.com/(X(1)S(iux3yorirotw1x55xqkxe155))/ShowArticle.aspx?ID=149&AspxAutoDetectCookieSupport=1
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VS 2017 18 108
Securing WEBAPI on Azure 2 28
How to fix 'event logs could not be searched' error asp.net? 3 18
ASP.NET Complete Life Cycle for all the controls 2 22
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question