| | |
Avoid the Page_Load after clicking dropdownlist
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2008
Posts: 47
Reputation:
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
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: passing parameter
- Next Thread: ? Website Admin Tool
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formview gridview gudi iis javascript list listbox login menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice wizard xsl






