469,306 Members | 2,463 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

page events in C# INIT-LOAD-PRE-RENDER

Hi colleagues,

how are the page events handled in C#? In VB you have the handles
keyword. and in C# all the params (object and EventArgs ) are the same
for 3 eventhandlers below.
a- How does the framework know which one is page_load, and which one
is PreRender?
Is it because of the name?
b- If I would like to add these events in C# code behind, what is the
trick. I just copy and paste it. In VB you can select from
dropdownlistboxes?

thanks for any advice,

cheers,
mesut
(1)
protected void Page_PreRender(object sender, EventArgs e)
//--------------------------------------------------------------------------
{
do somethig
}
(2)
//--------------------------------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
do something
}
(3)
protected void Page_Init(object sender, EventArgs e)
{
}

Oct 4 '07 #1
3 36732
Hello mesut,

Firstly, this question is more appropriate to asp.net group

ma- How does the framework know which one is page_load, and which one
mis PreRender? mIs it because of the name?

each page in asp.net 2.0 has the AutoEventWireup tag set to true, which means
that all this page event initialization are made explicitly for u.

mb- If I would like to add these events in C# code behind, what is the
mtrick. I just copy and paste it. In VB you can select from
mdropdownlistboxes?

just select the page or the control and set the handler for the desired event
in the properties manually
---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Oct 4 '07 #2
Hi Michael,

sorry if it was wrong group. I just started learning C# and I thought
I could post the question to this group because of C#, but you're
right it's more asp.net question.
your first answer: but how does the system now
that this protected void Page_PreRender(object sender, EventArgs e)
is PAGE_PRERENDER
and this is protected void Page_Load(object sender, EventArgs e) is
PAGE LOAD
etc.
is it because of the name?

thanks for your answers. If you don't answer no harm. thanks anyway...
I'll post it to other group then.

cheers, mesut

Oct 4 '07 #3
Hello mesut,

have u read this http://msdn2.microsoft.com/en-us/lib...entwireup.aspx
?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
mHi Michael,
m>
msorry if it was wrong group. I just started learning C# and I thought
mI could post the question to this group because of C#, but you're
mright it's more asp.net question.
myour first answer: but how does the system now
mthat this protected void Page_PreRender(object sender, EventArgs e)
mis PAGE_PRERENDER
mand this is protected void Page_Load(object sender, EventArgs e) is
mPAGE LOAD
metc.
mis it because of the name?
mthanks for your answers. If you don't answer no harm. thanks
manyway... I'll post it to other group then.
m>
mcheers, mesut
m>
Oct 4 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jack Wright | last post: by
1 post views Thread by Jarek | last post: by
2 posts views Thread by Josh | last post: by
reply views Thread by richard.haber | last post: by
3 posts views Thread by =?Utf-8?B?VDhS?= | last post: by
1 post views Thread by Lit | last post: by
13 posts views Thread by Scott M. | last post: by
2 posts views Thread by kellygreer1 | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.