我新装了.net 2.0 发现好多都不一样了
做个用户控件,想要传递参数
做了个get set
老是提示 "线程堆栈溢出"我的用户控件是这么做的
ascx文件:
public int topn {
set { topn = value; }
get { return topn; }
} protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.binddata();
}
} private void binddata()
{
SqlConnection conn = DB.conn();
// conn.ConnectionTimeout = 1000;
conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select top "+this.topn+" * from mail", conn);
DataSet ds = new DataSet();
da.Fill(ds);
this.DataList1.DataSource = ds.Tables[0];
this.DataList1.DataKeyField = "ID";
this.DataList1.DataBind(); }我调用的页面: list uc = (list)this.Page.LoadControl("list.ascx");
uc.topn = 5;
this.PlaceHolder1.Controls.Add(uc);
做个用户控件,想要传递参数
做了个get set
老是提示 "线程堆栈溢出"我的用户控件是这么做的
ascx文件:
public int topn {
set { topn = value; }
get { return topn; }
} protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.binddata();
}
} private void binddata()
{
SqlConnection conn = DB.conn();
// conn.ConnectionTimeout = 1000;
conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select top "+this.topn+" * from mail", conn);
DataSet ds = new DataSet();
da.Fill(ds);
this.DataList1.DataSource = ds.Tables[0];
this.DataList1.DataKeyField = "ID";
this.DataList1.DataBind(); }我调用的页面: list uc = (list)this.Page.LoadControl("list.ascx");
uc.topn = 5;
this.PlaceHolder1.Controls.Add(uc);
public int topn {
set { m_topn = value; }
get { return m_topn ; }
}