J
James Todman
I have a user control that contains a data grid type control (it's part of a
3rd party DAL), a text box and a button. When the button is clicked it takes
the text and stores it in the database. I then want the data grid to re-bind
to the datasource, refresh itself, so that when the page is then rendered
afterwards, the data is shown.
I've added an OnClick event handler for the button that adds the data to the
database, it then resets the grid, rebinds and refreshes. However, this for
some reason doesn't actually show the updated data until I re-navigate to
the page.
If I change the code so that the update is done during the user control's
OnLoad event and check the IsPostback property and handle the update inside
there it works. However, I only want to store the data if they click on the
button inside the user control. There are other controls that can cause a
postback, and I don't want the data to be stored when another button is
clicked.
My question is, is this the intended behaviour? It seems that rendering is
performed before the event is handled. Should the control be doing something
else to ensure that the grid is refreshed by the time the page comes to
render?
Cheers,
James
3rd party DAL), a text box and a button. When the button is clicked it takes
the text and stores it in the database. I then want the data grid to re-bind
to the datasource, refresh itself, so that when the page is then rendered
afterwards, the data is shown.
I've added an OnClick event handler for the button that adds the data to the
database, it then resets the grid, rebinds and refreshes. However, this for
some reason doesn't actually show the updated data until I re-navigate to
the page.
If I change the code so that the update is done during the user control's
OnLoad event and check the IsPostback property and handle the update inside
there it works. However, I only want to store the data if they click on the
button inside the user control. There are other controls that can cause a
postback, and I don't want the data to be stored when another button is
clicked.
My question is, is this the intended behaviour? It seems that rendering is
performed before the event is handled. Should the control be doing something
else to ensure that the grid is refreshed by the time the page comes to
render?
Cheers,
James