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/