ASP.NET - how to maintain a temporary dataTable.

Asked By shah zeb on 05-Jan-12 04:48 AM
Hi,
I have a checkboxlist.
I want to maintain its check state in a temporary dataTable.
e.g., if a new item is checked. i want to add new row to a dataTable. which has two columns storing the dataTextField and DataValueField.
how can this be done?

Regards,
Jitendra Faye replied to shah zeb on 05-Jan-12 04:52 AM
Try like this-

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)

{


DataTable dt = new DataTable();

DataColumn col1 = new System.Data.DataColumn("col1");

dt.Columns.Add(col1);


DataRow row = dt.NewRow();

row[0] = CheckBox1.Checked.ToString() ;

dt.Rows.Add(row);

 

}

shah zeb replied to Jitendra Faye on 05-Jan-12 05:08 AM
Thank You Vickey
Jitendra Faye replied to shah zeb on 05-Jan-12 05:29 AM
You always welcome.