0
我在webform上有一個用戶控件。我有用戶控件上的viewstate支持的公共屬性。在webform的代碼隱藏中,我嘗試設置公共屬性。當我通過代碼背後的代碼進行調試時,調試器從不將我帶到setter。同樣,公共屬性的文本框的值永遠不會被設置。爲什麼?用戶控件屬性在集合上失敗
//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; }
}
}
當您在'SetCommunicationControlText'上放置斷點並進入該賦值時會發生什麼?要進入屬性,請參閱此stackoverflow答案:http://stackoverflow.com/a/4873299/507793 – Matthew
它從來沒有介入。它跨越了下一行。就像我打F10,而不是F11。 – webapparchitect
你從哪裏調用'SetCommunicationControlText'方法? – Win