Author: NTH | Posted on: 9/17/2008 10:54:09 AM | Views : 422

Hi Experts, 
I am facing a weird problem with not using Viewstate for a datalist, which I have tried to outline below. Any help will be highly appreciated!

I have a Datalist with Edit & Delete capabilities, so I have the OnEditCommand, OnDeleteCommand, OnUpdateCommand & OnCancelCommand event handlers defined on this datalist.

Note: the Edit & Delete buttons are inside the ItemTemplate & Update & Cancel buttons are inside the EditItemTemplate

If I have the Viewstate enabled on the datalist & have the databind() called in the condition if (!IsPostBack), everything works fine.

But since I do not want the data in the datalist to be carried around in the Viewstate, I do the following:

1) Disable Viewstate on the datalist

2) Call the databind() without the if (!IsPostBack) condition - i.e. rebind datalist on each request

The behavior now is as follows:

1) On pressin ...

Go to the complete details ...