111,076
社区成员




//用户控件
public partial class Usercontrol_PageIndex2 : System.Web.UI.UserControl
{
private string _controlName = "";
public string ControlName
{
get { return _controlName; }
set { _controlName = value; }
}
}
//页面后台
public partial class CommunicationSpace : System.Web.UI.Page
{
Usercontrol_PageIndex2 buc = (Usercontrol_PageIndex2)Page.LoadControl("PageIndex2.ascx");
buc.ControlName = "aaa";//这样赋值没用,用户控件加载时ControlName还是空值
}
public string SelectedDay
{
get
{
return ViewState["selectedDay"] == null ? DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day : ViewState["selectedDay"].ToString();
}
set
{
ViewState["selectedDay"] = value;
}
}