473,769 Members | 6,160 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UserControl Page_InitComple te

based on MSPress's ASP.NET 2.0 Applications Advaced Topics ( Table 12-3
p.472 ), and
most events should be automatically wired up when @Control
AutoEventWireup ="true".
ie. Page_InitComple te() {} should be invoked automatically without having to
wire up the event as : Page.InitComple te+=new
EventHandler(Pa ge_InitComplete );
It seems that this is only true for a fairly restricted set of events which
does not include Page_InitComple te.
I thought that maybe a call to UserControl.Ini tializeAsUserCo ntrol() ( ibid
Table12-2 ) might be necessary but this method seems to be non-existant.
Is the documentation wrong or have I missed a setting somewhere ?
Also, when working with WebForms,UserCo ntrols etc in VS2005, thecontrol/page
itself is no longer listed on the control list at the top of properties
window as it was in vs2003 which means that all properties & events must be
set/added/wired up manually unlike other controls. Is there a new way to
access properties and events for WebForms & UserControls or is there a
setting i've missed to add these back to the property editor or did MS
remove this capability for some reason ?

Gerry
Aug 17 '06 #1
2 3394
Thanks Steven,

I will see where I can submit an errata report to mspress regarding the
autoevent wireup for user controls in the book mentioned - i did look for
this initially but found none. As the book specifically states that the
autoamatic event hookup for usercontrols includes a list of 16 events and
not just the 9 you have listed.

My work around for form/control events was to enter override[space] in the
code view which causes intellisense to list all overridables for the current
class' base classes. But for a supposed RAD ide this to me is a big step
backwards. I will submit some feedback on this point as suggested.

Gerry
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:eC******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hello Gerry,

As for the AutoEventWireup setting of the ASP.NET @Page and @Control
directive, I think your understanding is right. When we turn on the
"AutoEventWireu p" of the @Page and @Control directive, we can directly
write event handler functions for Page or UserControl without explicitly
registering them.

As for the following symptom you mentioned
=============== ===
It seems that this is only true for a fairly restricted set of events
which
does not include Page_InitComple te.
=============== ===

this is actually due to the limited events of the UserControl rather than
the ability of "AutoEventWireu p" support. As in the class library
reference
below, we can find that all the available events of UserControl are:

AbortTransactio n
CommitTransacti on
DataBinding
Disposed
Error
Init
Load
PreRender
Unload
#UserControl Events
http://msdn2.microsoft.com/en-us/library/d6thxdk7.aspx

For the above events, we can directly put event handler function in
codebehind when "AutoEventWireu p" is enabled. And some other Page specfiic
events such as "InitComple te", "LoadComple te" is not available for
UserControl.

=============== ============
Also, when working with WebForms,UserCo ntrols etc in VS2005,
thecontrol/page
itself is no longer listed on the control list at the top of properties
window as it was in vs2003 which means that all properties & events must
be
set/added/wired up manually unlike other controls.
=============== ============

Yes, I've also noticed this limitation of the c# source code editor for
page/usercontrol. In VS 2003, since all the page and codebehind class is a
single file class(rather than the partial class which need to compile
together with aspx/ascx), we can manipulate its events like normal
controls
on the page in Properties Windows. And in VS 2005, VB.NET page still
supports select events from dropdownlist to add event handler(and by
default autoeventwireup is turn off for VB.NET page).
Currently, what I usually do for VS 2005 cs page/usercontrol when try
adding eventhandler function is:

* in a page function, type "this" keyword and let the page member
intellisense windows popup

* in the popup intellsense member window, we can view all the available
events of the current class(this),

* type the event handler function according to the event name , ( "Page_"
+
EVENT_NAME), and the function signature of these basic events are all

FUNCTIONNAME(ob ject sender, EventArgs e)

Hope this would help a little for you to locate a certain page/usercontrol
event. (I've attached a screenshot on this and you can get it if you're
using Outlook express to visit the newsgroup)

Here is the msdn document describing creating event handler for web page
in
VS 2005:

#How to: Create Event Handlers in ASP.NET Web Pages (Visual Studio)
http://msdn2.microsoft.com/en-us/library/6w2tb12s.aspx
In addition, I think this is a reasonable request and would suggest you
supply a request in our pubilc feedback center so that our dev team can
also hear such feedback from community which is quite important for the
sequential version of the Dev Studio/tools. Any of your feedback and
comment is really appreciated.

#Visual Studio and .NET Framework Feedback
http://connect.microsoft.com/feedbac...spx?SiteID=210
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.
>




Aug 21 '06 #2
Thanks for your followup Gerry,

Yes, the book's statement seems a bit incorrect according to Usercontrol's
supported model. Sure, you can also submit the request of the errata.

If there is anything else we can help or any other information you wonder,
please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 22 '06 #3

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

Similar topics

2
7123
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 be able to drag-and-drop to the treeview from outside the UserControl. Now, when I drag over the treeview in the UserControl, the UserControl gets the drag-and-drop events, but the treeview doesn't. Is there a simple way to pass drag-and-drop...
8
1960
by: Raed Sawalha | last post by:
Hi, I have a strange problem with a usercontrol on a page. The usercontrol dispalyes three categories (From a database) when the user clicks a category they see all the products in a shop for that category, the results are paged 10 to a page and the user can page them. As this "Category" usercontrol hardly ever changes I wanted to setup up caching for it. However I realised that when the user clicks a ctageory it is selected and...
2
2247
by: Eric Maia | last post by:
I have two UserControls I am using in a form. These are each also used separately in two other forms. The structure is essentially this: CourseUserControl.ascx - select or enter a course SessionUserControl.ascx - select or enter a course session CourseDetails.aspx - a form which contains just CourseUserControl CourseSessionDetails.aspx - a form which contains just SessionUserControl TrainingRequestDetails.aspx - a form which includes...
2
4633
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation for me! I apologize for the length of this posting, but I wanted to make sure that I get an answer other than "Hey man, just use LoadControl!", because this is not what I want. The Task: Isolate a collection of web forms which are created as
41
4321
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based on some initialization information obtained elsewhere. Basically, I'm going to create my own dynamic toolbar where the toolbarbuttons can change. I'm not using the VB toolbar because of limitations in changing things like backcolor (I can't get...
12
2212
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control server. It "serves" back the required control (either WebControl or UserControl) based on the contents of an xml file. The code in the webform places each control in a TableCell. My problem is that the control server works as far as returning the...
9
14459
by: Marcelo Cabrera | last post by:
Hi, I have a user control that in turn creates a bunch of webcontrols dynamically and handles the events these webcontrols raise. It used to work fine on ASP .Net 1.1 but when compiled on 2.0 it does not. The problem is that the webcontrols get created on the OnLoad event of the usercontrol and the event handlers are assigned at the same time. I have to click twice on the controls for the events to be raised, the first time nothing...
6
12140
by: MeowCow | last post by:
I have created a UserControl that encapsulates a third party data grid. My goal was to create my own DataSource and DataMember properties that forward the binding to the third party grid, then use binding like normal. The problem I am running into is that my UserControl ends up with a different BindingContext then the ParentForm it is contained in and thus all other controls on the parent form. (I want various controls on the form to...
10
2428
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's my question. Once the UserControl is dropped onto the container page, how can I perform some action on the codebehind of the container page from the codebehind of the UserControl? For instance, suppose that the UserControl is dropped inside one...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.