•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 402,974 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,722 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 299 | Replies: 2
![]() |
•
•
Join Date: May 2008
Posts: 47
Reputation:
Rep Power: 1
Solved Threads: 0
I have a user control dropdownlist, and its intended that when a user selects any item from dropdownlist , then accordingly image is displayed on the same form.
My problem is, when i select once from dropdownlist then , the page is going through the page_load and after clicking again the second time, it again walks through page_load and diretly displayes image
My question is, is it possible to avoid the page_load in any way ? & to load when i select the item first time from the dropdownlist ??
please help me to resolve this...
My problem is, when i select once from dropdownlist then , the page is going through the page_load and after clicking again the second time, it again walks through page_load and diretly displayes image
My question is, is it possible to avoid the page_load in any way ? & to load when i select the item first time from the dropdownlist ??
please help me to resolve this...
If you want the code inside the Page_load to execute just the first time the page loads and prevent it from executing subsequently, put this part of code inside an if not IsPostBack block
IsPostBack is a Boolean property of a page when is set (=true) when a page is first loaded. Thus, the first time that the page loads the IsPostBack is false and for subsequent PostBacks, it is true.
Read more here: http://dotnet.tekyt.info/?p=30
asp.net Syntax (Toggle Plain Text)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ' Code here that needs to be executed only on first page_load End If End Sub
IsPostBack is a Boolean property of a page when is set (=true) when a page is first loaded. Thus, the first time that the page loads the IsPostBack is false and for subsequent PostBacks, it is true.
Read more here: http://dotnet.tekyt.info/?p=30
My blog on .NET- http://dotnet.tekyt.info
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the ASP.NET Forum
- Previous Thread: passing parameter
- Next Thread: Next, Previous buttons in ASP.NET.


Linear Mode