Page_Load problem

  • Thread starter Thread starter DirkDiggler
  • Start date Start date
D

DirkDiggler

Hi

In Page_Load event I retrieve data from db and put them
into text controls. When I change some data and then
press the Send button, first the Page_Load is called, and
then method for Send button, in which I put data into db.
I cant change anything because every time I press Send,
first Page_Load is called and its discards every changes I made.
How to get around this?
Thanks in advance for any advice.

Lu
 
Get the Data only when the Page Loads for the first time, this can be done by checking for Page.IsPostBac

if(! Page.IsPostBack

// Write code here to get data from DB


I hope this solves your problem

Thanx

Nimish
 
Hi,

PageLoad fires each time in ASP.Net to get ride of that u can use
Page.IsPostBack property.

If the Page.IsPostBack property is false, the page is loaded for the first
time, if it is true, the page is posted back to the server .

Regds.
Sanjai
 
Thanks

Few minutes after sending that post i made it up by myself.
Before, I tried to use Request.IsPostBack but it wasnt
it. Page.IsPostBack solved the problem.

Thanks
Lu
 
Back
Top