Monday, May 10, 2010

Drop down calender without using AJAX in VB.NET

1.Do the following in DropdownCal.aspx page:
Add Button Control ID=Button1
ADD Text Box Control ID=TextBox1
Add Calender Control ID=Calender1 with nSelectionChanged="Calendar1_SelectionChanged"

Wrap above controls in DIV ID=div1

2. Do The following in DropdownCal.aspx page:

Add Button Control ID=Button2
ADD Text Box Control ID=TextBox2
Add Calender Control ID=Calender2 with nSelectionChanged="Calendar2_SelectionChanged"

Wrap above controls in DIV ID=div2

3. Add following code in code behind:


Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged

Me.TextBox1.Text = Me.Calendar1.SelectedDate.ToString()

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Calendar1.Visible = True
End Sub

Protected Sub Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar2.SelectionChanged
Me.TextBox2.Text = Me.Calendar2.SelectedDate.ToString()
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Calendar2.Visible = True
End Sub

No comments:

Post a Comment