Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

problem with page_loading

  Asked By: Fern    Date: Oct 11    Category: Asp.net    Views: 619
  

i've still a small problem...

I've made a web-application with 2 webforms, let me call them A and B

When A loads for the very first time a connection to a database is made,
data added in DataSet, and some dataTables added to the DataSet
and everything is bound to a dataGrid
By clicking on some buttons, B is loaded, where i manipulate the data in
the DataTables
Then there is a redirection to A again

There i just want to do a dataBind of the changed dataTables in my
DataSet...

Which construction do i have to make for this situation
I've done smth like this code, but this doesn't work...
The part between If not ispostback then and else may just be done once, on
the very first time

How can i do that?

Txs in advance,

Scoopie



For A:

Sub Page_load

If not ispostback then

...
get data in dataSet
add some dataTables
Databind to datagrid
...

Else

Bind dataGrid

End if

End sub

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Kanchan Ap     Answered On: Oct 11

Make a Session var and initialise it to true,
(C# sorry)


Sub Page_load

If not ispostback then
If ((boolean)Session["var"]){
...
get data  in dataSet
 add  some dataTables
Databind to datagrid
...
Session["var"] = false;
}


Else

Bind dataGrid

End if

End sub

should do it for once  per session.

If you need to do it just once for everytime the pageloads - add something like

OnPageUnload(......){
Session["var"] = true;
}

 
Answer #2    Answered By: Haya Yoshida     Answered On: Oct 11

Txs for answering my question, the answer seems me easier then the problem... I was looking after a kind of other reservated syntax words as ispostback but this works just fine!

 
Didn't find what you were looking for? Find more on problem with page_loading Or get search suggestion and latest updates.




Tagged: