Using Calendar as a popup

M

Merex

Hello all,

I want to use the Calendar control as a popup window. I would like
each day's link to execute some javascript which would set the value
of a textbox on the window which opened the calendar and then close
the calendar window. So basically I want to customize the <A> tag for
each date to call my custom JavaScript function.

function SelectedDate(strDate) {
window.opener.document.forms["frmMain"].elements["txtDate"].value =
strDate;
}

Can anyone point me in the right direction. I am thinking that I
might be able to hook into some event that the calendar generates...

Thanks,
Ross
 
S

S. Justin Gengo

Merex,

I'm not certain if you can easily hook this up to the calendar itself so
that it all executes client side. How about using the body tag a server
control and placing your script into its onload event. Doing so would
require that the calendar post back when a value is selected but it would
then function exactly as you are attempting.

If you decide to go this route I have some sample code in the code library
of my site, www.aboutfortunate.com, that shows how to use the body tag as a
server control. Just search the code library for: "use the body tag as a
server control" or something similar.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
R

Ravikanth[MVP]

Hi

Check out this may help you.

http://www.excentricsworld.com/customcontrols.aspx?id=7

Ravikanth[MVP]

-----Original Message-----
Hello all,

I want to use the Calendar control as a popup window. I would like
each day's link to execute some javascript which would set the value
of a textbox on the window which opened the calendar and then close
the calendar window. So basically I want to customize
the said:
each date to call my custom JavaScript function.

function SelectedDate(strDate) {
window.opener.document.forms["frmMain"].elements ["txtDate"].value =
strDate;
}

Can anyone point me in the right direction. I am thinking that I
might be able to hook into some event that the calendar generates...

Thanks,
Ross
.
 
J

jayuya

Ross,
There was a posting related to this about 3 or 6 weeks
ago. Search for calendar control or popups. The code
sample was posted by savarana from Miscrosoft india, she
has a really good sample code of what you are looking for.
I think she implemented a custom coontrol to do so. If not
I will email again as soon as I find the web link of it.
but if you find it posted again so that we can all have
the link to the sample calendar control..

thanks,
jayuya


-----Original Message-----
Hello all,

I want to use the Calendar control as a popup window. I would like
each day's link to execute some javascript which would set the value
of a textbox on the window which opened the calendar and then close
the calendar window. So basically I want to customize
the said:
each date to call my custom JavaScript function.

function SelectedDate(strDate) {
window.opener.document.forms["frmMain"].elements ["txtDate"].value =
strDate;
}

Can anyone point me in the right direction. I am thinking that I
might be able to hook into some event that the calendar generates...

Thanks,
Ross
.
 
S

Saravana

Check out this article ( this was the article mentioned by jayuya)
http://www.microsoft.com/india/msdn/articles/PopupCalendarinASP.aspx
or
www.extremeexperts.com/net/articles (For more articles on .NET)

--
Saravana
Microsoft India Community Star,MC**
www.extremeexperts.com



jayuya said:
Ross,
There was a posting related to this about 3 or 6 weeks
ago. Search for calendar control or popups. The code
sample was posted by savarana from Miscrosoft india, she
has a really good sample code of what you are looking for.
I think she implemented a custom coontrol to do so. If not
I will email again as soon as I find the web link of it.
but if you find it posted again so that we can all have
the link to the sample calendar control..

thanks,
jayuya


-----Original Message-----
Hello all,

I want to use the Calendar control as a popup window. I would like
each day's link to execute some javascript which would set the value
of a textbox on the window which opened the calendar and then close
the calendar window. So basically I want to customize
the said:
each date to call my custom JavaScript function.

function SelectedDate(strDate) {
window.opener.document.forms["frmMain"].elements ["txtDate"].value =
strDate;
}

Can anyone point me in the right direction. I am thinking that I
might be able to hook into some event that the calendar generates...

Thanks,
Ross
.
 
M

Merex

Thanks for all the replys. I made it work not long after posting
this.

protected void onDayRender(object sender,
System.Web.UI.WebControls.DayRenderEventArgs e) {
DateTime dtDate = e.Day.Date;
e.Cell.Controls.Clear();

HtmlAnchor anchor = new HtmlAnchor();
anchor.HRef="Javascript:SelectDate('"+dtDate.ToString("MM/dd/yyyy")+"')";
anchor.InnerHtml = Convert.ToString(dtDate.Day);
e.Cell.Controls.Add(anchor);
}

Thanks,
Ross
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Positioning a popup 10
popup calendar when using Masterpage 6
Popup calendar 1
Calendar popup - sort of 2
popup calendar 0
Non-popup calendar control? 5
Closing an overlay outside the overlay as well 1
Calendar! 1

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top