Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Displaying submitted data on page load

Status
Not open for further replies.

ben1234zz

MIS
May 12, 2008
71
GB
Hello

We have a page similar to a shopping cart... when we post the data we want to load it in the returned page.

However it appears that the page load procedure runs before the control command procedure on the page.

Therefore the databind occurs before the page modifies it!!

Is there a way around this?

Thanks
B
 
this is the page life cycle. there is no way around that. usually with webforms the pattern is
Code:
page_load(...)
{
   if(IsPostBack) return;
   MyGridView.DataSource = GetData();
   MyGridView.DataBind();
}

button_click(...)
{
   if(!IsValid) return;
   SaveData();
   MyGridView.DataSource = GetData();
   MyGridView.DataBind();
}

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Hi

Thanks for your post.

I found a rough way round it by doing a server.transfer to the same page after the event fires. Not ideal but a solution to the problem.

Thanks again
B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top