Modifying Page_Init in Visual Studio apps
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngvs' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Eric Landes (VIP)
I just ran across a suggestion from the Crystaldecisions people to put =
code
to bind your crystalviewer into the Page_Init instead of Page_Load. =
When I
look at the Page_Init code, it states not to modfiy it when you view it =
in
VS. This makes sense to me. Am I off base in thinking you don't want =
to
modify the page_init in your Visual Studio app, (basically adding 2 =
lines to
it, one referencing a method on the page) or is this acceptable =
practice?

*************************=20
Eric Landes=20
Senior Programmer/Analyst=20
For Articles on Crystal.Net, Datagrids and more check out
http://www.aspalliance.com/corporatecoder/
*************************=20
All statements expressed are my own, and do not reflect the opinion of =
my
employer, unless stated otherwise.=20

Confidentiality Notice: This e-mail message, including any
attachments, is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message.

PARTNERS Health Plan Phone: 574-233-4899
100 E. Wayne St., Suite 502 Fax: 574-234-7484
South Bend, IN 46601 www.partnersindiana.com

Reply to this message...
 
    
Remas Wojciechowski
Eric,

VS creates two methods - an override for OnInit and InitializeComponents.
The only one you're kindly asked not to modify is the latter. You could add
custom initializations to the OnInit override (I usually create a new
private method for that). Another option is to use the constructor.

Btw, it's sometimes unavoidable to modify InitializeComponents (otherwise
the code won't compile). Example: you add a data grid, double-click it (an
event handler will be created and wired up) then decide you don't want that
event handler, delete it... now what? InitializeComponents still contains
the wire-up--you have to (to my knowledge) delete it manually unless you
want to delete the whole data grid and recreate it.

hth
Remas
http://www.aspalliance.com/remas

----- Original Message -----
From: "Eric Landes" <Click here to reveal e-mail address>
To: "aspngvs" <Click here to reveal e-mail address>
Sent: Thursday, July 25, 2002 10:12 PM
Subject: [aspngvs] Modifying Page_Init in Visual Studio apps

I just ran across a suggestion from the Crystaldecisions people to put code
to bind your crystalviewer into the Page_Init instead of Page_Load. When I
look at the Page_Init code, it states not to modfiy it when you view it in
VS. This makes sense to me. Am I off base in thinking you don't want to
modify the page_init in your Visual Studio app, (basically adding 2 lines to
it, one referencing a method on the page) or is this acceptable practice?

*************************
Eric Landes
Senior Programmer/Analyst
For Articles on Crystal.Net, Datagrids and more check out
http://www.aspalliance.com/corporatecoder/
*************************
All statements expressed are my own, and do not reflect the opinion of my
employer, unless stated otherwise.

Confidentiality Notice: This e-mail message, including any
attachments, is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message.

PARTNERS Health Plan Phone: 574-233-4899
100 E. Wayne St., Suite 502 Fax: 574-234-7484
South Bend, IN 46601 www.partnersindiana.com

| [aspngvs] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngvs.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
Saurabh Nandu (VIP)
Hi Remas,

Well just though to send a little Tip ... select the DataGrid in Design
Window, and move to the Properties Explorer, switch to the Events tab
(in C#). You should find the definition of the Event there... just
delete the event definition from there ... and change the focus to some
other textbox.

This should delete the event you had wired-up ..
No need for manual delete ;)

Hope that helps ..

Regards,
Saurabh Nandu
[Microsoft MVP]
www.MasterCSharp.com
Master C#, the easy way...

[Original message clipped]

Reply to this message...
 
    
Eric Landes (VIP)
Thanks Remas. Guess I need to do a little more reading up on that. =
I'll
test some of the code there. Thanks

Eric

-----Original Message-----
From: Remas Wojciechowski [mailto:Click here to reveal e-mail address]
Sent: Friday, July 26, 2002 3:42 AM
To: aspngvs
Subject: [aspngvs] Re: Modifying Page_Init in Visual Studio apps

Eric,

VS creates two methods - an override for OnInit and =
InitializeComponents.
The only one you're kindly asked not to modify is the latter. You could =
add
custom initializations to the OnInit override (I usually create a new
private method for that). Another option is to use the constructor.

Btw, it's sometimes unavoidable to modify InitializeComponents =
(otherwise
the code won't compile). Example: you add a data grid, double-click it =
(an
event handler will be created and wired up) then decide you don't want =
that
event handler, delete it... now what? InitializeComponents still =
contains
the wire-up--you have to (to my knowledge) delete it manually unless you
want to delete the whole data grid and recreate it.

hth
Remas
http://www.aspalliance.com/remas

----- Original Message -----
From: "Eric Landes" <Click here to reveal e-mail address>
To: "aspngvs" <Click here to reveal e-mail address>
Sent: Thursday, July 25, 2002 10:12 PM
Subject: [aspngvs] Modifying Page_Init in Visual Studio apps

I just ran across a suggestion from the Crystaldecisions people to put =
code
to bind your crystalviewer into the Page_Init instead of Page_Load. =
When I
look at the Page_Init code, it states not to modfiy it when you view it =
in
VS. This makes sense to me. Am I off base in thinking you don't want =
to
modify the page_init in your Visual Studio app, (basically adding 2 =
lines to
it, one referencing a method on the page) or is this acceptable =
practice?

*************************
Eric Landes
Senior Programmer/Analyst
For Articles on Crystal.Net, Datagrids and more check out
http://www.aspalliance.com/corporatecoder/
*************************
All statements expressed are my own, and do not reflect the opinion of =
my
employer, unless stated otherwise.

Confidentiality Notice: This e-mail message, including any
attachments, is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message.

PARTNERS Health Plan Phone: 574-233-4899
100 E. Wayne St., Suite 502 Fax: 574-234-7484
South Bend, IN 46601 www.partnersindiana.com

| [aspngvs] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngvs.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

| [aspngvs] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngvs.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Confidentiality Notice: This e-mail message, including any
attachments, is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message.

PARTNERS Health Plan Phone: 574-233-4899
100 E. Wayne St., Suite 502 Fax: 574-234-7484
South Bend, IN 46601 www.partnersindiana.com

Reply to this message...
 
    
Terry Voss
Saurabh,

Interesting tip, but I can't find hide nor hare of a properties explorer
with an event tab.
Could you kindly direct me? :)

Terry Voss
Developer/Owner
Computer Consulting
Microsoft Certified Partner
http://www.computer-consulting.com
Click here to reveal e-mail address
2403 North Nettleton Street
Spokane WA 99205
Tel: 509-327-7202
Fax: 509-327-2303
http://www.spokaneoutdoors.com

-----Original Message-----
From: Saurabh Nandu [mailto:Click here to reveal e-mail address]
Sent: Friday, July 26, 2002 3:37 AM
To: aspngvs
Subject: [aspngvs] Re: Modifying Page_Init in Visual Studio apps

Hi Remas,

Well just though to send a little Tip ... select the DataGrid in Design
Window, and move to the Properties Explorer, switch to the Events tab
(in C#). You should find the definition of the Event there... just
delete the event definition from there ... and change the focus to some
other textbox.

This should delete the event you had wired-up ..
No need for manual delete ;)

Hope that helps ..

Regards,
Saurabh Nandu
[Microsoft MVP]
www.MasterCSharp.com
Master C#, the easy way...

[Original message clipped]

| [aspngvs] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngvs.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
 
System.Web.UI.WebControls.DataGrid
System.Windows.Forms.DataGrid




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com