Calendar control - .Net

Trying to get Calendar control to post value to one of my textboxes in
Also want to format my calendar control to be much smaller in box size as well as show the calendar in separate window when user clicks on an icon.

Need some general code ideas using a calendar control and a basic textbox control in as well as how to format the size of window and text....and get the calendar control to pop up in a window before it posts the date selected back to the textbox.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

just change height and width properties in the control below to the desired size.
Then save the page with a control as caledar.aspx page and use javascript function to open it in a separate window.

<asp:Calendar ID="myDates"
              CellPadding = "2"
              CellSpacing = "2"
              OnSelectionChanged="YOUR FUNCTION"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
put this in the <head> section of your page from which you'll be opening your calendar page
<script language="JavaScript">


function get_calendar(url) {

link =,"myCalendar","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=500,left=40,top=50");


then you can assign javascript function to href attribute of a button:
myButton.Attributes.Add("href", "javascript:get_calendar('calendar.aspx')")
dba123Author Commented:
Ok, thanks for the properties of the calendar control but for the button, I am using an ASP.Net button.  I don't think mybutton.attributes.add is ASP.NET, isn't this javascript?

please inform how I would form my button to call the function and then also how I would grab the value that the user selects from the calendar to be the value of my TextBox
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

dba123Author Commented:
using ASP.Net, not JavaScript
dba123Author Commented:
I know ASP uses JavaScript for some of the functions so fill me in on the Button control for launching and positioning the calendar then grabbing the value
dba123Author Commented:
I got it to work.  After I click on the calendar, I figure out logic to get it in the textbox.  Now all I need remining is how to pop the calendar up when the user clicks on the button
dba123Author Commented:
Can I use CSS or DHTML to position my calendar next the the button after I click the asp imagebutton?
dba123Author Commented:
I can figure out the positioning the rest of the way and will use the Visible property of the calendar control.

myButton.Attributes.Add("href", "javascript:get_calendar('calendar.aspx')")
is code that calls a javaScript to open a new window
or you can use a hyperlink to open a new window:

<asp:hyperlink target=_blank NavigateUrl="calendar.aspx" Runat="server">Open</asp:hyperlink>
AnnieMod, why should question be closed, I pretty much answered it and  dba123 said it was working?
I tested it myself and it is working. Why shouldn't I get the points?
dba123Author Commented:
Let me work with YZlat on his suggestion.

YZlat, I couldn't find this in my ASP.Net book.  Where do I put myButton.Attributes.Add?  in a sub function?  or in the conrol itself.  Any resources on attributes such as what you just gave me?  I'll look also and try getting it to work as you suggested again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.