Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: unable to get the calender controls selected date???


Message #1 by "dwarakanath h" <madivi2002@y...> on Wed, 10 Apr 2002 22:40:37
Hi 

I have a webform with a textbox, a calender control and a push button on 
it. In the VB code of the form I have a public property that returns the 
selected date by calling SelectedDate property. However doesn't return the 
correct date when I'm calling it from the other page. Can you please help 
me out.


The following is the VB code of the First form

Form1.vb

Public Class WebForm1
    Inherits System.Web.UI.Page
    Protected WithEvents lblUID As System.Web.UI.WebControls.Label
    Protected WithEvents txtUID As System.Web.UI.WebControls.TextBox
    Protected WithEvents lblWeek As System.Web.UI.WebControls.Label
    Protected WithEvents clnWeek As System.Web.UI.WebControls.Calendar
    Protected WithEvents btnGo As System.Web.UI.WebControls.Button


    Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles btnGo.Click
        Server.Transfer("EnterTimeSheet.aspx")
    End Sub

    Public ReadOnly Property UserID() As String
        Get
            Return txtUID.Text
        End Get
    End Property

    Public ReadOnly Property Week() As Date
        Get
            Return clnWeek.SelectedDate
        End Get
    End Property


End Class


Second forms VB code

Public Class EnterTimeSheet
    Inherits System.Web.UI.Page
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Public firstForm As WebForm1

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not IsPostBack Then
            fp = CType(context.Handler, WebForm1)
            Label1.Text = firstForm.UserID.ToString & "," & _
                            firstForm.Week.ToString

        End If
    End Sub

End Class




  Return to Index