DataList为什么不能动态取得CheckBox状态,只能获得初始值。
private void DataList1_DeleteCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
{
bool x=((CheckBox)DataList1.Items[0].FindControl("CB")).Checked;
Label3.Text=x.ToString();
if(x)
{
//DateTime time=Convert.ToDateTime(((Label)e.Item.FindControl("Label2")).Text);RegTime=#"+time+"# and
string sql="delete from Message where UserName='"+UserName+"'";
OleDbCommand com=new OleDbCommand(sql,Conn);
Conn.Open();
com.ExecuteNonQuery();
Conn.Close();
}
}