471,337 Members | 1,171 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

HELP!! calendar within a usercontrol....

Hi,

I have a calendar control within a usercontrol. The calendar is to be used
on serveral pages of a web site - hence the use of a usercontrol.

I now wish to grab the value of Calendar_SelectionChanged and display in a
label on the main aspx page.

I thought I would be able to do this by having a Public Property within the
code behind for the usercontrol as follows :

Public Property ConcertDate() As String

Get

Return calConcerts.SelectedDate.ToString("dd/MM/yyyy")

End Get

Set(ByVal Value As String)

End Set

End Property


Then within the code behind for the main page I would have the follwoing key
lines of code :

Protected WithEvents ctrlCalendar As MyCalendarUserControl ' declare the
usercontrol

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()

' get a reference to the ctrlCalendar user control.

ctrlCalendar = DirectCast(FindControl("ctrlCalendar"),
MyCalendarUserControl)

End Sub

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

lblConcertDate.Text = "Concert Date : " & ctrlCalendar.ConcertDate

End Sub


When I do this the selected date updates to the correct date following 2
clicks - it is one click behind!

I've read I may need to use event bubbling but being a beginner I do not
know whether this is the right way to go.

Please help.

Jul 21 '05 #1
0 920

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Nicole - ASP/C# Beginner | last post: by
2 posts views Thread by Mihaela Barbu via DotNetMonster.com | last post: by
5 posts views Thread by Mark Friedman | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.