popup date picker cannot choose today's date

Discussion in 'ASP .Net' started by TB, Mar 16, 2006.

  1. TB

    TB Guest

    Hi All:

    A kind soul provided by with the code for very nice calendar popup, which
    all in all works fine execpt for one thing: If I pick the current date (i.e.
    today's date) then the pop-up does not close and the date value is not
    returned to the target textbox. With any other date, everything works
    flawlessly, ie the popup closes upon selecting a date and the selected date
    is transfered to the corresponding textbox.

    Since I don't want to post a lot of code here, initially I will only list
    the what is in the calendarpopup.aspx.vb:

    Public Class CalendarPopup
    Inherits System.Web.UI.Page

    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub
    InitializeComponent()

    End Sub
    Protected WithEvents thedate As System.Web.UI.WebControls.Calendar
    Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
    Protected WithEvents control As
    System.Web.UI.HtmlControls.HtmlInputHidden

    'NOTE: The following placeholder declaration is required by the Web Form
    Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub

    #End Region
    Dim inidate As String
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    control.Value = Request.QueryString("textbox").ToString()
    inidate = Request.QueryString("inidate").ToString()
    thedate.SelectedDate = inidate
    thedate.VisibleDate = inidate
    Session.LCID = 1033
    End Sub

    Private Sub thedate_SelectionChanged(ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles thedate.SelectionChanged
    Dim script(4) As String

    script(1) = "<script>window.opener.document.forms[0]." +
    control.Value + ".value = '"
    script(2) = thedate.SelectedDate.ToString("MM/dd/yyyy")
    script(3) = "';self.close()"
    script(4) = "</" + "script>"
    RegisterClientScriptBlock("test", Join(script, ""))
    End Sub
    End Class

    If that is not enough to find the error please let me know, so I can post
    more code (for example the code generating the popup window).

    Thanks
     
    TB, Mar 16, 2006
    #1
    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. luna

    popup date picker

    luna, Mar 1, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,389
  2. C. Smith

    HTML popup date picker for input forms

    C. Smith, Apr 4, 2004, in forum: Javascript
    Replies:
    5
    Views:
    136
    Chris Gutierrez
    Apr 13, 2004
  3. JAG
    Replies:
    0
    Views:
    105
  4. Replies:
    1
    Views:
    154
  5. Replies:
    1
    Views:
    186
Loading...

Share This Page