0
當我想將其綁定到某些文本框我這樣做我背後的下列財產asp.net結合問題
public string Firstname {get;set;}
我的代碼:
<asp:TextBox runat="server" ID="txtFirstname" Text='<%# Bind("Firstname") %>'/>
那麼我想認沽值在這個文本框中設置我的名字屬性(因爲我想處理它,例如保存這個值)在我的主持人。 爲什麼它不起作用? 編輯 這裏是ASPX
<formview runat="server" ID="myFormView">
<p>Firstname <asp:TextBox ID="txtFirstName" runat="server" Text='<%# Eval("Firstname") %>' /></p>
<p>Lastname <asp:TextBox ID="txtLastName" runat="server" /></p>
<input type="button" title="send" runat="server" id="btnSend" />
</formview>
請參閱http://stackoverflow.com/questions/1997735/how-can-i-two-way-bind-a-textbox-to-a-code-behind-property-in-asp-net也http://stackoverflow.com/questions/2871404/asp-net-data-bind-two-way-bi-directional-from-code-behind – 2010-10-25 20:16:43
我後所需要的一切。沒有其他的東西在代碼背後設置(除了點擊提交按鈕時調用的方法) – 2010-10-25 20:18:06
你在Page_Load中調用Page.DataBind()嗎? – jordanbtucker 2010-10-25 20:23:20