DataSource & PostBack

  • Thread starter Thread starter SLE
  • Start date Start date
S

SLE

Hi there,

I am binding a DataTable of a typed DataSet to a DataList control. Two
columns are editable (i.e. Boolean types, implemented with a template column
and CheckBoxes). The user is allowed to change those two columns. A Button
is used to confirm modifications.

Problem is I can't figure out how to save changes. After postback,
DataList.DataSource is Nothing. I can enumerate all controls (CheckBoxes and
their Values) thanks to ViewState but I guess this is not the way to go.

Please point me in the right direction - thanks.
 
Hi,

in which event you're binding the datalist with the datatable. If this is
Page_Load, try it like this: -

if (!IsPostBack)
{
// Perform initial databinding
}
else
{
// don't write anything, let the controls restore their values
// from the Viewstate. Also, set the EnableViewState
// property for the list item true
}

Regards
Joyjit
 
Back
Top