|
-
Nov 29th, 2005, 08:31 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] imagebutton runs first page_load
Hello all,
I'm having a problem, and I'm sure someone could help me with this:
in an ASP .NET application I have several imagebuttons. I have a problem with them. Every time I click a button, the page load event is called instead of the method specified in the OnClick of the button...
what could be the base of this problem? I can't find it, but because it's a heavy application, each time I call the form, it is loaded twice instead of once.
The methods provides some action to the database, and then redirects to the same page with other parameters.
Does someone have a suggestion?
Thanx in advance,
Marco
-
Nov 29th, 2005, 09:19 AM
#2
Re: imagebutton runs first page_load
The Page Load event will always be called, everytime there is a postback. You should enclose the run-once-only code in your Page_Load event in a Page.IsPostBack check.
Does it call the image button's click event eventually?
-
Nov 30th, 2005, 05:05 AM
#3
Thread Starter
Hyperactive Member
Re: imagebutton runs first page_load
Well, I've searched, and searched, and searched... didn't find. Until tomorrow... Now I see what was going wrong:
VB Code:
If a or b or not page.ispostback Then
[INDENT]DoAction()
DoAction2()[/INDENT]
End If
it should be:
VB Code:
If a or b Then
[INDENT]If Not Page.IsPostBack Then
[INDENT]DoAction()
DoAction2()[/INDENT]
End If[/INDENT]
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|