VS .NET C# WebForm Project with DataGrid - DataBinding problem
Posted on 2003-12-09
VS .NET WebForm Project. Form has DataGrid. DataGrid has five columns
Four of the columns including ID are present in a DataBase table.
The fifth column is a Template Column. This column is :
class CheckBoxColumn :System.Web.UI.WebControls.TemplateColumn
The CheckBoxColumn contains an object of the class CheckBoxItem :
class CheckBoxItem : ITemplate
The CheckBoxItem instantiates a CheckBox object.
Note: AutoPostBack is used in this object, such
that PostBack takes place at each Click on the CheckBox obj.
By subscribing to events, the status of CheckBox.Checked can be
maintained,from code in FormName.aspx.cs --- so long
as no paging takes place.
The DataGrid is paged. When paging away from and then back to a page,
the status of the Checked properties is lost.
The meaning of the CheckBox.Checked is not meaningful in the
DataBase Table and can not be persisted there -it has User
specific meaning. The meaning
is relative to the session. The status of the checkboxes can
be persisted in , say a Session table,which is updated each time
there is a CheckedChanged event.
How and where do i merge the table from the DataBase with the Session table of
two columns (ID, and a boolean for the Checked status), such that
the DataBind() in Page_Load will cause the correct display of the
column #5. I find that the CheckChange event is raised after the
Page_Load() runs. Or is there a better approach?