How do i get to retrieve date from a pop up calender into a text box in VB ASP.NET 2.0?

  • Thread starter Thread starter Nayo
  • Start date Start date
N

Nayo

Guest
I have the VB code written below but it still does not work

Imports System.Web.UI.HtmlControls.HtmlGenericControl
Partial Class PopUp
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
control.Value = Request.QueryString("textbox").ToString()
End Sub



Protected Sub Change_Date(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calender1.SelectionChanged
Dim strScript As String = "<script>window.opener.document.forms(0)." + control.Value + ".value = '"
strScript += Calender1.SelectedDate.ToString("MM/dd/yyyy")
strScript += "';self.close()"
strScript += "</" + "script>"

If (Not Page.ClientScript.IsClientScriptBlockRegistered(Me.GetType(), "Calendar1_ChangeDate")) Then

Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "Calendar1_ChangeDate", strScript)
End If

End Sub
End Class
 
If you are using the form DateTimePicker then the value property has the date information. Use can use the .value.ToShortDate(), etc. methods to give you back a string to put into a text box
 
Back
Top