473,396 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Calendar control not raising events in UserControl

I have a UserControl that contains a calendar control. The calendar is not
raising events (month navigation, date selections, etc.). I've checked that
the OnSelectionChanged event has a handler being registered. Is there
anything else obvious or otherwise that I've missed? Is there a problem
using it in a UserControl?

Thanks

Colin
Nov 17 '05 #1
7 2666
Hi Colin,

Based on my research and experience, I would like to share the following
information with you.

Before the Page_Load event, asp.net loads in all the ViewState data, for
example, recreating your controls on web page. Then it matches up the
control that raises the postback with the actual control which was
regenerated from the ViewState. At this point, ASP.NET knows that this
particular control was fired and it adds the handler event to the list of
events that must be executed.

If the load phase was after the restore of the ViewState data, the event
will not fired as expected.

The ASP.NET page framework provides a technique called event bubbling that
allows a child control to propagate events up its containment hierarchy.
Event bubbling enables events to be raised from a more convenient location
in the controls hierarchy and allows event handlers to be attached to the
original control as well as to the control that exposes the bubbled event.

For more information, plesae check this article:

Bubbling an Event
http://msdn.microsoft.com/library/en...lingcommandeve
nt.asp

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #2
I've already checked the control tree using tracing and the UserControl that
is giving me trouble is being recreated with the same ID after postback, so
there should be no trouble matching up the event with the correct control.
The control is not dynamically created so there should be no trouble with it
being created too late in the process.

I'm attempting to handle the event within my User Control. Even if I add an
override for handling event bubbling, the OnEventBubble is never called. The
page does postback, it's just that the event never gets raised.

Just to be clear I have created a Web User Control, not a Custom Server
Control, although I may convert to a custom control since I have more
experience with those and have generally had better luck with them. I only
created a user control because I thought it would be quicker.

Colin

"Jacob Yang [MSFT]" <ji***@online.microsoft.com> wrote in message
news:vg**************@cpmsftngxa06.phx.gbl...
Hi Colin,

Based on my research and experience, I would like to share the following
information with you.

Before the Page_Load event, asp.net loads in all the ViewState data, for
example, recreating your controls on web page. Then it matches up the
control that raises the postback with the actual control which was
regenerated from the ViewState. At this point, ASP.NET knows that this
particular control was fired and it adds the handler event to the list of
events that must be executed.

If the load phase was after the restore of the ViewState data, the event
will not fired as expected.

The ASP.NET page framework provides a technique called event bubbling that
allows a child control to propagate events up its containment hierarchy.
Event bubbling enables events to be raised from a more convenient location
in the controls hierarchy and allows event handlers to be attached to the
original control as well as to the control that exposes the bubbled event.

For more information, plesae check this article:

Bubbling an Event
http://msdn.microsoft.com/library/en...lingcommandeve nt.asp

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #3
Nevermind... I've figured out what the problem is and it has nothing to do
with the user control or the calendar. My page is accessed by a
server.transfer and uses url rewriting, so the postback isn't really
occuring.

Now that I know what the problem is I just need to figure out how to fix
it...

Colin

"Colin Young" <x@nospam.com> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
I've already checked the control tree using tracing and the UserControl that is giving me trouble is being recreated with the same ID after postback, so there should be no trouble matching up the event with the correct control.
The control is not dynamically created so there should be no trouble with it being created too late in the process.

I'm attempting to handle the event within my User Control. Even if I add an override for handling event bubbling, the OnEventBubble is never called. The page does postback, it's just that the event never gets raised.

Just to be clear I have created a Web User Control, not a Custom Server
Control, although I may convert to a custom control since I have more
experience with those and have generally had better luck with them. I only
created a user control because I thought it would be quicker.

Colin

"Jacob Yang [MSFT]" <ji***@online.microsoft.com> wrote in message
news:vg**************@cpmsftngxa06.phx.gbl...
Hi Colin,

Based on my research and experience, I would like to share the following
information with you.

Before the Page_Load event, asp.net loads in all the ViewState data, for
example, recreating your controls on web page. Then it matches up the
control that raises the postback with the actual control which was
regenerated from the ViewState. At this point, ASP.NET knows that this
particular control was fired and it adds the handler event to the list of events that must be executed.

If the load phase was after the restore of the ViewState data, the event
will not fired as expected.

The ASP.NET page framework provides a technique called event bubbling that allows a child control to propagate events up its containment hierarchy.
Event bubbling enables events to be raised from a more convenient location in the controls hierarchy and allows event handlers to be attached to the original control as well as to the control that exposes the bubbled event.
For more information, plesae check this article:

Bubbling an Event

http://msdn.microsoft.com/library/en...lingcommandeve
nt.asp

Does it answer your question? If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Nov 17 '05 #4
Hi Colin,

I am sorry if there is any misunderstanding.

After reviewing your response, I have a little puzzle on your issue.

As I understand, you developed a UserControl, an ascx file, which contains
a Calendar server control. Then you instantiate the user control in a web
page.

In another web page, you use the Server.Transfer to invoke the web page
where the user control was located.

However, the problem is that in this situation, some events on the Calendar
inside the user control are not fired as expected.

On my side, to reproduce the issue, I did the following tests.

1. Create a web user control, a class inherits from
System.Web.UI.UserControl.
2. Drag and drop a Calendar control onto the user control.
3. Put a Response.Write statement inside the SelectionChanged handler of
the calendar control.
4. Create a web page and drag the ascx file (the user control) onto this
web page.
5. Create another webpage, which contains a button. In the click event of
the button, I just do the following thing:

Server.Transfer("the web page where the user control was located")

6. Set the web page created in step 5 as the start web page. Compile and
run the application. When the web page launches up, click the button to
trigger the Servevr.Transfer.
7. When the web page where the user control comes up, I click certain day
on the Calendar control, the SelectionChanged event is fired successfully.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #5
Hi Colin,

I am sorry if there is any misunderstanding.

After reviewing your response, I have a little puzzle on your issue.

As I understand, you developed a UserControl, an ascx file, which contains
a Calendar server control. Then you instantiate the user control in a web
page.

In another web page, you use the Server.Transfer to invoke the web page
where the user control was located.

However, the problem is that in this situation, some events on the Calendar
inside the user control are not fired as expected.

On my side, to reproduce the issue, I did the following tests.

1. Create a web user control, a class inherits from
System.Web.UI.UserControl.
2. Drag and drop a Calendar control onto the user control.
3. Put a Response.Write statement inside the SelectionChanged handler of
the calendar control.
4. Create a web page and drag the ascx file (the user control) onto this
web page.
5. Create another webpage, which contains a button. In the click event of
the button, I just do the following thing:

Server.Transfer("the web page where the user control was located")

6. Set the web page created in step 5 as the start web page. Compile and
run the application. When the web page launches up, click the button to
trigger the Servevr.Transfer.
7. When the web page where the user control comes up, I click certain day
on the Calendar control, the SelectionChanged event is fired successfully.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #6
I'm also using URL rewriting. I encountered the problem detailed in KB
Q817036. The work-around presented in that article has cleared up the
problem for me.

Thanks for taking the time to investigate my issue.

Colin

"Jacob Yang [MSFT]" <ji***@online.microsoft.com> wrote in message
news:wa*************@cpmsftngxa06.phx.gbl...
Hi Colin,

I am sorry if there is any misunderstanding.

After reviewing your response, I have a little puzzle on your issue.

As I understand, you developed a UserControl, an ascx file, which contains
a Calendar server control. Then you instantiate the user control in a web
page.

In another web page, you use the Server.Transfer to invoke the web page
where the user control was located.

However, the problem is that in this situation, some events on the Calendar inside the user control are not fired as expected.

On my side, to reproduce the issue, I did the following tests.

1. Create a web user control, a class inherits from
System.Web.UI.UserControl.
2. Drag and drop a Calendar control onto the user control.
3. Put a Response.Write statement inside the SelectionChanged handler of
the calendar control.
4. Create a web page and drag the ascx file (the user control) onto this
web page.
5. Create another webpage, which contains a button. In the click event of
the button, I just do the following thing:

Server.Transfer("the web page where the user control was located")

6. Set the web page created in step 5 as the start web page. Compile and
run the application. When the web page launches up, click the button to
trigger the Servevr.Transfer.
7. When the web page where the user control comes up, I click certain day
on the Calendar control, the SelectionChanged event is fired successfully.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #7
I'm also using URL rewriting. I encountered the problem detailed in KB
Q817036. The work-around presented in that article has cleared up the
problem for me.

Thanks for taking the time to investigate my issue.

Colin

"Jacob Yang [MSFT]" <ji***@online.microsoft.com> wrote in message
news:wa*************@cpmsftngxa06.phx.gbl...
Hi Colin,

I am sorry if there is any misunderstanding.

After reviewing your response, I have a little puzzle on your issue.

As I understand, you developed a UserControl, an ascx file, which contains
a Calendar server control. Then you instantiate the user control in a web
page.

In another web page, you use the Server.Transfer to invoke the web page
where the user control was located.

However, the problem is that in this situation, some events on the Calendar inside the user control are not fired as expected.

On my side, to reproduce the issue, I did the following tests.

1. Create a web user control, a class inherits from
System.Web.UI.UserControl.
2. Drag and drop a Calendar control onto the user control.
3. Put a Response.Write statement inside the SelectionChanged handler of
the calendar control.
4. Create a web page and drag the ascx file (the user control) onto this
web page.
5. Create another webpage, which contains a button. In the click event of
the button, I just do the following thing:

Server.Transfer("the web page where the user control was located")

6. Set the web page created in step 5 as the start web page. Compile and
run the application. When the web page launches up, click the button to
trigger the Servevr.Transfer.
7. When the web page where the user control comes up, I click certain day
on the Calendar control, the SelectionChanged event is fired successfully.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dave Veeneman | last post by:
Is there a simple way to pass drag-and-drop events to a child control in a UserControl? Here's an example: I have created a UserControl which contains a treeview and some text boxes. I want to...
0
by: chris | last post by:
Hi there I want to create a UserControl which simply uses a textbox and a calendar. The calendar's visibility is set to false. If I click the ImageButton the Calendar is visible. When you select a...
1
by: Iams | last post by:
I have one form, with 2 user controls. How can I get the procedures on uc2 to modify a drop down list on uc1? I tried various versious of this in uc2: uc1.ddl.SelectedIndex =...
4
by: louise raisbeck | last post by:
Resending this as own topic as didnt get answer from original. Would be grateful for a response from anyone that knows. Thanks. Hi there, I found your post really helpful..but i wondered if, once...
0
by: Scott McChesney | last post by:
I have a problem I hope you folks can help me with. I have an application that is using a tab-based interface, with the ability for users to drag an item from a ListBox onto the tab control. ...
5
by: Paul Bromley | last post by:
For some time now I have been struggling trying to understand how to handle events originating in a User Control that I have designed when using this in an application. Basically I need to respond...
1
by: Anonieko | last post by:
I know Visual Studio lacked support on easily writing code to raise events from a ascx user control ( because you have to hand write them)....
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
7
by: Christian Cambier | last post by:
Hi, I have a textbox in a web user control. I then add the usercontrol to a web form. I also add a label in the web form. Now, when I press a key in the textbox, i want to display some text...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.