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

vb functions evaluating on load

Hi there, I have created a vb server function which i want to evaluate when a server control button is clicked (only!) however it is evaluating the code on load even though i havent put it into the page_load function. why is it evaluating and not waiting for the calling click event? I have made it just plain sub. not private or anything FYI and have put it in the CBPage. thanks.
Nov 18 '05 #1
4 1455
On Tue, 3 Aug 2004 09:25:03 -0700, louise raisbeck
<lo************@discussions.microsoft.com> wrote:
Hi there, I have created a vb server function which i want to evaluate
when a server control button is clicked (only!) however it is evaluating
the code on load even though i havent put it into the page_load
function. why is it evaluating and not waiting for the calling click
event? I have made it just plain sub. not private or anything FYI and
have put it in the CBPage. thanks.


Can you share some code? Show us the code/event where the function is
called, etc.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
=?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=
<lo************@discussions.microsoft.com> wrote in
news:8C**********************************@microsof t.com:
Hi there, I have created a vb server function which i want to evaluate
when a server control button is clicked (only!) however it is
evaluating the code on load even though i havent put it into the
page_load function. why is it evaluating and not waiting for the
calling click event? I have made it just plain sub. not private or
anything FYI and have put it in the CBPage. thanks.


This doesn't make too much sense...

Are you saying the Page_Load is run before your event handler is firing?
This is because ASP.NET needs to recreate the page before any event
handlers are fired.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #3
ok i have a function in my aspx.vb code behind page called get_xml. it does some reading on an xml file and returns it to the browser. But i only want it to fire when a button is clicked so i have this on my aspx page:
<input type="button" id="getxmlbutton" onserverclick="get_xml" value="edit xml" runat="server">

and this function in my aspx.vb CB page

Sub get_xml(ByVal sender As System.Object, ByVal e As System.EventArgs)
blah blah
End Sub

my page_load is empty. But instead of this function waiting for the button to fire the event on the onserverclick, it runs it on load, so it goes and fetches xml before the user has even entered an xml file in a field. why is it running the function?


"Lucas Tam" wrote:
=?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=
<lo************@discussions.microsoft.com> wrote in
news:8C**********************************@microsof t.com:
Hi there, I have created a vb server function which i want to evaluate
when a server control button is clicked (only!) however it is
evaluating the code on load even though i havent put it into the
page_load function. why is it evaluating and not waiting for the
calling click event? I have made it just plain sub. not private or
anything FYI and have put it in the CBPage. thanks.


This doesn't make too much sense...

Are you saying the Page_Load is run before your event handler is firing?
This is because ASP.NET needs to recreate the page before any event
handlers are fired.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #4
Forget about Page_Load. Your problem has nothing to do with Page_Load.
Page_Load is simply an event that happens, among many others. You have
defined a Sub that executes a certain functionality. Now, are you saying
that this Sub runs EVERY TIME the page is requested, regardles of PostBack
or any user events? If not, precisely what conditions cause this Sub to run?
Also, is there any code in the page, or in any of the controls in the page,
that calls this Sub?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"louise raisbeck" <lo************@discussions.microsoft.com> wrote in
message news:6B**********************************@microsof t.com...
ok i have a function in my aspx.vb code behind page called get_xml. it does some reading on an xml file and returns it to the browser. But i only
want it to fire when a button is clicked so i have this on my aspx page:

<input type="button" id="getxmlbutton" onserverclick="get_xml" value="edit xml" runat="server">
and this function in my aspx.vb CB page

Sub get_xml(ByVal sender As System.Object, ByVal e As System.EventArgs)
blah blah
End Sub

my page_load is empty. But instead of this function waiting for the button to fire the event on the onserverclick, it runs it on load, so it goes and
fetches xml before the user has even entered an xml file in a field. why is
it running the function?

"Lucas Tam" wrote:
=?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=
<lo************@discussions.microsoft.com> wrote in
news:8C**********************************@microsof t.com:
Hi there, I have created a vb server function which i want to evaluate
when a server control button is clicked (only!) however it is
evaluating the code on load even though i havent put it into the
page_load function. why is it evaluating and not waiting for the
calling click event? I have made it just plain sub. not private or
anything FYI and have put it in the CBPage. thanks.


This doesn't make too much sense...

Are you saying the Page_Load is run before your event handler is firing?
This is because ASP.NET needs to recreate the page before any event
handlers are fired.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #5

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

Similar topics

99
by: David MacQuigg | last post by:
I'm not getting any feedback on the most important benefit in my proposed "Ideas for Python 3" thread - the unification of methods and functions. Perhaps it was buried among too many other less...
15
by: Xah Lee | last post by:
Here's the belated Java solution. import java.util.List; import java.util.ArrayList; import java.lang.Math; class math { public static List range(double n) { return range(1,n,1); }
2
by: Matt Priest | last post by:
Hello All, I have encountered a difference between compilers and need some help understanding what is happening. I have a function such as: void MyClass::foo(GenericType& myarg){...} ...
21
by: Rubén Campos | last post by:
I haven't found any previous message related to what I'm going to ask here, but accept my anticipated excuses if I'm wrong. I want to ask about the real usefulness of the 'inline' keyword. I've...
17
by: cwdjrxyz | last post by:
Javascript has a very small math function list. However there is no reason that this list can not be extended greatly. Speed is not an issue, unless you nest complicated calculations several levels...
9
by: ferbar | last post by:
Hi all, I'm trying to read from the txt file 'ip.packets.2.txt' using the read function. It seems everything ok, but I get a -1 when executing >>bytesr = read(fdo1, bufread, 2); The 'open'...
6
by: Don Wash | last post by:
Hi All! I'm developing ASP.NET pages using VB.NET language. My background is VB6 and ASP3. Right now, I'm evaluating strategies on creating reusable and common functions and methods for ASP.NET....
18
by: Franky | last post by:
I don't know how to ask this so that someone will not misread it but here goes. At run time I want to be able to evaluate functions from the Math library, but at design time I do not know what...
4
by: ahagley | last post by:
The problem: 1) I'm not a programmer, most of the time I'm a physicist, but I do numerical simulation. 2) I have a DLL that I want to use functions from. I have the .h file associated with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.