473,386 Members | 1,821 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,386 software developers and data experts.

PreRender AddHandler?

Joe
Hello All:

Can I wire server control events in the page's PreRender event and have them
take effect?

I am rendering LinkButtons in a Table on a webform and am using AddHandler
to wire each LinkButton's click event to a private method in the page. The
AddHandler calls are:

AddHandler nameLink.Click, New System.EventHandler(AddressOf HandleLinkClick)
AddHandler numberLink.Click, New System.EventHandler(AddressOf
HandleLinkClick)

where nameLink and numberLink are the names of one of the LinkButtons.

Both LinkButtons appear in each row of the table and each has its
CommandArguement property set to either "Name" or "Number." During PostBack,
I will use HandleLinkClick to determine which LinkButton (either name or
number) was clicked and then rebuild the table based on this choice.

If I run this code in the Page's Load event, HandleLinkClick is called (i.e.
I can get to the CommandArguement property) but it is called after the table
is built; if I run the code in the PreRender event, HandleLinkClick is not
called at all.

Any feedback would be appreciated.

TIA,
--
Joe
May 2 '06 #1
2 2261
Joe
Never mind. I got it.
--
Joe
"Joe" wrote:
Hello All:

Can I wire server control events in the page's PreRender event and have them
take effect?

I am rendering LinkButtons in a Table on a webform and am using AddHandler
to wire each LinkButton's click event to a private method in the page. The
AddHandler calls are:

AddHandler nameLink.Click, New System.EventHandler(AddressOf HandleLinkClick)
AddHandler numberLink.Click, New System.EventHandler(AddressOf
HandleLinkClick)

where nameLink and numberLink are the names of one of the LinkButtons.

Both LinkButtons appear in each row of the table and each has its
CommandArguement property set to either "Name" or "Number." During PostBack,
I will use HandleLinkClick to determine which LinkButton (either name or
number) was clicked and then rebuild the table based on this choice.

If I run this code in the Page's Load event, HandleLinkClick is called (i.e.
I can get to the CommandArguement property) but it is called after the table
is built; if I run the code in the PreRender event, HandleLinkClick is not
called at all.

Any feedback would be appreciated.

TIA,
--
Joe

May 2 '06 #2
How?

SA

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
Never mind. I got it.
--
Joe
"Joe" wrote:
Hello All:

Can I wire server control events in the page's PreRender event and have
them
take effect?

I am rendering LinkButtons in a Table on a webform and am using
AddHandler
to wire each LinkButton's click event to a private method in the page.
The
AddHandler calls are:

AddHandler nameLink.Click, New System.EventHandler(AddressOf
HandleLinkClick)
AddHandler numberLink.Click, New System.EventHandler(AddressOf
HandleLinkClick)

where nameLink and numberLink are the names of one of the LinkButtons.

Both LinkButtons appear in each row of the table and each has its
CommandArguement property set to either "Name" or "Number." During
PostBack,
I will use HandleLinkClick to determine which LinkButton (either name or
number) was clicked and then rebuild the table based on this choice.

If I run this code in the Page's Load event, HandleLinkClick is called
(i.e.
I can get to the CommandArguement property) but it is called after the
table
is built; if I run the code in the PreRender event, HandleLinkClick is
not
called at all.

Any feedback would be appreciated.

TIA,
--
Joe

May 2 '06 #3

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

Similar topics

1
by: Alireza Ziai | last post by:
I have problem with prerender event in my page I dont know why prerender event occurs immediatley after Load event , I have same problem with Unload event too ,is it a problem with framework or sth ?
0
by: Andy Wang | last post by:
I need change HeaderText of DataGrid in PreRender(). But it seems doesn't work. The code example like this: Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)...
4
by: Adam Boczek | last post by:
I've a dropdownlist control to change language on my page. Because of page lifetime, I have to set all my labels, texts etc. from ResourceManager in prerender handler to be sure that culture change...
3
by: Matt Jensen | last post by:
Howdy all - and seasons greetings Just wondering, I've recently discovered the PreRender event for .NET (both for the page and for controls), which seems like a life saver for doing page data...
1
by: John Dalberg | last post by:
I am trying to send a webpage with datagrids as an email so I use the code snippet below. In one of my datagrids, I reformat some rows in the datagrid's Prerender event. The code behind of the page...
2
by: Joe | last post by:
Hello All: I have been bitten a few times lately as I've tried to implement functionality in the Page_PreRender event. So here is my question: for what purpose do you use the PreRender event?...
0
by: mutlyp | last post by:
I have a PreRender event to set the width of my textbox when the Edit button is pressed on my grid here is the code: Private Sub grdPBC_PreRender(ByVal sender As Object, ByVal e As...
3
by: jc | last post by:
Hello. I have a gridview column item that i want to not make visible if the bound data in that cell is less than a value in a textbox. However, I notice at the time my code checks a function...
2
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
i'm not sure how the preRender event gets handled. if i have a function: protected void tbPasswordPreRender(object sender, EventArgs e) { tbPswd1.Attributes = tbPswd1.Text; tbPswd2.Attributes...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.