using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { string connstr = "server=.;database=pubs;uid=sa;pwd="; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bind(); } } private void bind() { SqlConnection conn = new SqlConnection(connstr); conn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from stu", conn); DataSet ds = new DataSet(); da.Fill(ds); conn.Close(); DataList1.DataSource = ds.Tables[0]; DataList1.DataBind(); } protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e) { ((System.Web.UI.WebControls.Panel)e.Item.FindControl("Panel1")).Visible=false; } }
隐藏datalist里面的Panel控件
最新推荐文章于 2019-06-10 19:38:08 发布