English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a form that I am using to post data to a database table and a gridview on the same page that is displaying the data.

When I post the data, the grid view is not updated until I manually reload the page.

I know that the whole page is not being cached becuase I have printed the current time and this changes when the form is submitted.

2007-05-22 23:57:09 · 3 answers · asked by Alan 1 in Computers & Internet Programming & Design

3 answers

You see the page is not being cached, but the data is being loaded from ViewState. Make sure you refresh the GridView after updating the DataSource.

private void Page_Load( ... ) {
if(!Page.IsPostBack() {
BindGridView();
}
}

private void BindGridView() {
//set DataSource of your GridView
//call the DataBind() method of your GridView
}

//call the BindGridView() method whenever you update your DataSource


Hope this helps.

2007-05-24 20:27:12 · answer #1 · answered by Smutty 6 · 0 0

Make sure the method that populates the GridView is being executed when the page posts back and not just on first load.

2007-05-23 01:56:41 · answer #2 · answered by Rex M 6 · 0 0

This may be of interest to you :
http://msdn.microsoft.com/msdnmag/issues/05/01/ASPNETPerformance/

2007-05-23 00:02:46 · answer #3 · answered by Cupcake 7 · 0 0

fedest.com, questions and answers