DataSource & PostBack

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.
 
J

Joyjit Mukherjee

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top