Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   Problems wit events (http://www.velocityreviews.com/forums/t755920-problems-wit-events.html)

Norbeto Mesen 10-08-2003 10:45 PM

Problems wit events
 
Hi, everybody


I have a problem with the events in a web page.
I have a botton with a method that should execute a method on mouse click
but for some reason (that I don't know) it is executing the page_Load before
the method call, WHY?
What I need is that the method be called before any event and If its
possible to cancel the Page_Load, or where else I can set this code in the
button. This is what I have. The Page_Load always gets fired when I click
onm btnBuscar. Any ideas.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If IsPostBack Then
End If
End Sub


Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnBuscar.Click
Dim condicion As String
condicion = ""
PrepareCondition(Page, condicion)
If condicion.Length <> 0 Then
condicion = " WHERE " & condicion.Substring(4)
End If
Session("tcWhere") = condicion
Response.Redirect("frmMansgrPoliza.aspx")
End Sub

Also I have another problem if i refresh the page with F5 function key, the
click event on the botton always gets re-executes.


Thanks ahead,
Norberto





Rich Mercer 10-09-2003 09:01 AM

Problems wit events
 
The Page_Load event is always called before any control
event. Try placing your Page_Load code into a method and
call the method from Page_Load using the IsPostBack
property to only call it on the first page load then you
can call it from your controls event if you need to but
it wont execute after a post back.

HTH.

Rich Mercer
MCAD

>-----Original Message-----
>Hi, everybody
>
>
>I have a problem with the events in a web page.
>I have a botton with a method that should execute a

method on mouse click
>but for some reason (that I don't know) it is executing

the page_Load before
>the method call, WHY?
> What I need is that the method be called before any

event and If its
>possible to cancel the Page_Load, or where else I can

set this code in the
>button. This is what I have. The Page_Load always gets

fired when I click
>onm btnBuscar. Any ideas.
>
>Private Sub Page_Load(ByVal sender As System.Object,

ByVal e As
>System.EventArgs) Handles MyBase.Load
> If IsPostBack Then
> End If
>End Sub
>
>
>Private Sub btnBuscar_Click(ByVal sender As

System.Object, ByVal e As
>System.EventArgs) Handles btnBuscar.Click
>Dim condicion As String
>condicion = ""
>PrepareCondition(Page, condicion)
>If condicion.Length <> 0 Then
>condicion = " WHERE " & condicion.Substring(4)
>End If
>Session("tcWhere") = condicion
>Response.Redirect("frmMansgrPoliza.aspx")
>End Sub
>
>Also I have another problem if i refresh the page with

F5 function key, the
>click event on the botton always gets re-executes.
>
>
>Thanks ahead,
>Norberto
>
>
>
>
>.
>


Norberto Mesén López 10-09-2003 05:37 PM

Re: Problems wit events
 
Thank for your help

But I Also I have another problem if i refresh the page with F5 function
key, the click event on the botton always gets re-executes.

Thanks ahead,
Norberto



"Rich Mercer" <richard.mercer@waveworks.co.uk> wrote in message
news:091d01c38e43$f8b7e460$a401280a@phx.gbl...
> The Page_Load event is always called before any control
> event. Try placing your Page_Load code into a method and
> call the method from Page_Load using the IsPostBack
> property to only call it on the first page load then you
> can call it from your controls event if you need to but
> it wont execute after a post back.
>
> HTH.
>
> Rich Mercer
> MCAD
>
> >-----Original Message-----
> >Hi, everybody
> >
> >
> >I have a problem with the events in a web page.
> >I have a botton with a method that should execute a

> method on mouse click
> >but for some reason (that I don't know) it is executing

> the page_Load before
> >the method call, WHY?
> > What I need is that the method be called before any

> event and If its
> >possible to cancel the Page_Load, or where else I can

> set this code in the
> >button. This is what I have. The Page_Load always gets

> fired when I click
> >onm btnBuscar. Any ideas.
> >
> >Private Sub Page_Load(ByVal sender As System.Object,

> ByVal e As
> >System.EventArgs) Handles MyBase.Load
> > If IsPostBack Then
> > End If
> >End Sub
> >
> >
> >Private Sub btnBuscar_Click(ByVal sender As

> System.Object, ByVal e As
> >System.EventArgs) Handles btnBuscar.Click
> >Dim condicion As String
> >condicion = ""
> >PrepareCondition(Page, condicion)
> >If condicion.Length <> 0 Then
> >condicion = " WHERE " & condicion.Substring(4)
> >End If
> >Session("tcWhere") = condicion
> >Response.Redirect("frmMansgrPoliza.aspx")
> >End Sub
> >
> >Also I have another problem if i refresh the page with

> F5 function key, the
> >click event on the botton always gets re-executes.
> >
> >
> >Thanks ahead,
> >Norberto
> >
> >
> >
> >
> >.
> >





All times are GMT. The time now is 12:38 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.