4
我無法在文本框中獲取任何新條目:將txtMyString設置爲屬性MyString。我在這裏錯過了什麼?如何雙向綁定TextBox到ASP.NET中的代碼隱藏屬性?
<asp:TextBox ID="txtMyString" Text='<%# MyString %>' runat="server" />
private string myString;
protected string MyString { get { return myString; } set { myString = value; } }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
myString = "1 way test works";
DataBind();
}