我在网络表单上有一个用户控件。我在用户控件上有由 viewstate 支持的公共属性。在网络表单的代码隐藏中,我尝试设置公共属性。当我在设置点通过后面的代码进行调试时,调试器永远不会将我带到设置器。同样,公共属性的文本框的值永远不会被设置。为什么?
//aspx page with reference to user control on a telerik tab/page view
<telerik:RadPageView ID="radpvCommunication" runat="server">
<uc:Communication ID="Communication1" runat="server" />
</telerik:RadPageView>
//Webform method to set user control public property
private void SetCommunicationControlText()
{
Communication1.SubjectTextBoxText = "This is a test set from organization";
}
//user control code
public partial class CommunicationUserControl : UserControl
{
public string SubjectTextBoxText
{
get { return ViewState["SubjectTextBoxText"].ToString(); }
set { ViewState["SubjectTextBoxText"] = value; }
}
}