Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

DataTable question

Here is a problem I'm having in an ASP .NET application:

I have a DataTable which corresponds to a table on a MS SQL Server.

To this DataTable, I have added a column which isn't in the physical table.

I use a grid to display the DataTable to the user. The grid has paging enabled, and it works ok.

The problem is that every time I modify something in the custom column, and then change pages, it seems to revert back to the default value!

This is very strange.

Why does this happen?

Is the DataSet kept between different requests for the aspx page, or is it created every time the page is requested?

Thank you!

Galaxy George
Thursday, September 25, 2003

Are you saving the changes to the dt from one page to another, or is the .BindData() being called again and wiping the added column?

Thiaz Harbinger
Friday, September 26, 2003

Sub Page_Load(...)
  If (Not IsPostback) Then
      myDataTable = getTable()
      'Don't DataBind here - table is already persisted in ViewState
  End If
End Sub

Duncan Smart
Friday, September 26, 2003

*  Recent Topics

*  Fog Creek Home