Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 26th, 2010, 02:50 PM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
  #2 (permalink)  
Old November 26th, 2010, 04:11 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,133
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?
  #3 (permalink)  
Old November 26th, 2010, 07:33 PM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

yes postback=true,
what should i do now?
  #4 (permalink)  
Old November 27th, 2010, 07:58 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
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.
  #5 (permalink)  
Old November 29th, 2010, 11:48 AM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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?
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 06:52 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.