Although Daniel may have solved his problem, I am still interested in
putting some word down here.
The correct way/order of executing the codes should be:
Under the Page_Load event:
If Not Page.IsPostBack Then
... 'code to fill dataset
DataGrid1.DataBind()
End If
Under the Button1_Click event:
... 'code to add record to database
... 'code to fill dataset
DataGrid1.DataBind()
I hope this should help.
Previous message:
> Hi all,
I have a .net page with a datagrid and button,
When I click the button it adds a new record to a database.
However the datagrid does not display the last record added.
I know the grid is being refreshed as when I add the next record the
previous record added is shown.
e.g.
Add Record 1 New Record NOT Seen.
Add Record 2 - Record 1 is now displayed.
Add Record 3 - Record 2 is now displayed.
etc, etc.............
This is now starting to be a major milestone in my project.
Can anyone help me
Thanks in advance
Daniel.