Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 26th, 2010, 02:50 PM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default button click event make my web read again page load

hi,
when i press the button ,its make my page read th e page load again.
its a problem for me because my page load have must reading a new topic all the time.(its a random page).
so instead reading my button event its refresh my page.

sorry about my awful english
 
Old November 26th, 2010, 04:11 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Use Page.IsPostBack to see if you are in a postback in the page load event.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old November 26th, 2010, 07:33 PM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

yes postback=true,
what should i do now?
 
Old November 27th, 2010, 07:58 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

:) No, that's not what he means.

In the button postback=true will trigger a postback, yes.

Now you want the code behind to do different things if the page is postback or not. Typically you break items up into three groups like this...

protected void Page_Load(...blahblah...)
{

... This is code you always want executed whether the page is postback or not...

if (Page.IsPostBack)
{
...Code that should only execute if the page IS postback...
}

if (!Page.IsPostBack)
{
...Code that should only execute if the page id NOT postback, the exclamation point means "not"...
}
}
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old November 29th, 2010, 11:48 AM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

its not good for me.
the page load are reading a random sql id.
the button do like,
if i press the button is reading again id,so he cant do like.

u fell me?





Similar Threads
Thread Thread Starter Forum Replies Last Post
flash button not causing page load event olambe Flash (all versions) 3 June 22nd, 2007 10:17 PM
on the click of a button how to load another form? amit_mande@yahoo.com VB.NET 2 September 12th, 2006 06:53 AM
How to Click a button on a web page in VB code AJD Beginning VB 6 0 June 2nd, 2006 12:08 PM
flash button not causing page load event olambe BOOK: ASP.NET Website Programming Problem-Design-Solution 1 June 27th, 2004 09:02 PM
Run a web page in java application on button click mathsyaka Java GUI 3 July 2nd, 2003 11:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.