473,405 Members | 2,287 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,405 software developers and data experts.

Best way to create Page_PreRender in VB.Net

Hi,

Quick question. What's the best way to create the handler for
Page_Prerender in ASP.Net 2.0. I used to just use the dropdowns to
select (Page Events) on the left and choose PreRender in the right hand
dropdown. Now however these are not listed.

Any recommendations?

Stew

Dec 17 '05 #1
3 3937
In vb.net there's always three ways to implement a base method. There are
some minor diferences between then (not functionality though). I'd pick the
one the most consistant with how you do it within the rest of your system.

1 - (the way I guess you probably want it)
Protected Sub Page_PreRender(ByVal s As Object, ByVal e As EventArgs)
Handles Me.PreRender
'code here
End Sub
2 -
Protected Overrides Sub onPreRender(ByVal e As System.EventArgs)
'code here
MyBase.OnPreRender(e)
End Sub
3 -
'put this in Init or somwhere
AddHandler Me.PreRender, AddressOf Page_PreRender2

Protected Sub Page_PreRender2(ByVal sender As Object, ByVal e As
System.EventArgs)
'code here
End Sub

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

<wi**************@yahoo.com.au> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi,

Quick question. What's the best way to create the handler for
Page_Prerender in ASP.Net 2.0. I used to just use the dropdowns to
select (Page Events) on the left and choose PreRender in the right hand
dropdown. Now however these are not listed.

Any recommendations?

Stew

Dec 17 '05 #2
Hi Karl,

Thanks for your response. I was actually more interested in how you do
this through the IDE. I used to be able to create handlers like
Page_PreRender by using the two dropdowns above the code.

Thoughts?

Dec 17 '05 #3
Stew,

Maybe you want the TAB complete functionality in VS.NET ?

Inside your page's Page_Load method, you can type:

this.PreRender +=

and then you should see Intellisense telling you to hit the TAB key for
autocomplete functionality. You hit TAB the first time and it completes
your statement by appending:

new EventHandler(_Default_PreRender);

Then, you hit TAB a second time, and the IDE inserts a new
corresponding method body below:

void _Default_PreRender(object sender, EventArgs e)
{
throw new Exception("The method or operation is not
implemented.");
}

Then you just replace the Exception throwing statement with your
desired code.
(Note: in this case, my page class is named _Default, so your method
name may vary).

Hope that helps.

Regards,
Albert Braun

Dec 17 '05 #4

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

Similar topics

1
by: Sparhawk | last post by:
I ran into troubles binding my repeater controls in Page_PreRender. The problem is that the Repeater_ItemCommand does not fire if the control is bound in Page_PreRender. It works fine if I am...
1
by: Ashish | last post by:
Hi I have been using Page_Load event for a long time . But never used Page_Prerender. I have seen in articles tht whtever u can do in Page_Load can be done in Page_Prerender also.But wht are the...
1
by: SingLu | last post by:
I'm going nuts here. I'm using VS2005 and C# and would like to create a simple page and use the page_init-event. I add a new page but can't find a way to make VS add a eventhandler. If I dbl.click...
2
by: jdp | last post by:
I've created a custom login control with values that are not used in the Membership table. I created these other fields through the <profiletag in the web config. I'm able to get a new member...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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...

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.