Using Calendar as a popup

Discussion in 'ASP .Net' started by Merex, Aug 7, 2003.

  1. Merex

    Merex Guest

    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
    Merex, Aug 7, 2003
    #1
    1. Advertising

  2. 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


    "Merex" <> wrote in message
    news:...
    > 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. Justin Gengo, Aug 7, 2003
    #2
    1. Advertising

  3. 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 <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
    >.
    >
    Ravikanth[MVP], Aug 7, 2003
    #3
  4. Merex

    jayuya Guest

    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 <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
    >.
    >
    jayuya, Aug 7, 2003
    #4
  5. Merex

    Saravana Guest

    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" <> wrote in message
    news:0c9901c35d08$be2fefc0$...
    > 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 <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
    > >.
    > >
    Saravana, Aug 8, 2003
    #5
  6. Merex

    Merex Guest

    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
    Merex, Aug 11, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephajn Craig

    Javascript PopUp using Calendar Control

    Stephajn Craig, Jul 22, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    625
    Saravana
    Jul 23, 2003
  2. =?Utf-8?B?QWxp?=

    popup calendar when using Masterpage

    =?Utf-8?B?QWxp?=, Feb 28, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    9,196
    dcasing
    May 28, 2007
  3. =?Utf-8?B?Q2hyaXM=?=
    Replies:
    3
    Views:
    13,730
    Peter Blum
    Mar 30, 2005
  4. dapkniht
    Replies:
    1
    Views:
    1,316
    Eliyahu Goldin
    Mar 8, 2006
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    498
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page