Link to home
Start Free TrialLog in
Avatar of Salah a a a Al Jasem
Salah a a a Al JasemFlag for Kuwait

asked on

VB.net How to execute Page_Load One time

VB 2015

One the web page I have a list box that has 2 items added using Page_Load as follows

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ListBox1.Items.Add(New ListItem("Item1))
        ListBox1.Items.Add(New ListItem("Item2))
    End Sub

So the list box will have

Item1
Item2

In the same web page there is a button
Page_Load is executed every time a button is clicked

As a result List box is becoming

Item1
Item2
Item1
Item2

And Keeps on growing every time Button is clicked!    I discovered that Page_Load is loaded every time the button is clicked.
Is there a way to execute Page_Load once
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Salah a a a Al Jasem

ASKER

Many thanks
Exact answer