ASP.NET Tutorial/Data Binding/TextBox
DataBind TextBox
<script runat="server" language="C#">
protected void Page_Load(object o, EventArgs e) {
if(IsPostBack) {
Page.DataBind();
}
}
</script>
<form runat="server">
Add two numbers:
<asp:TextBox runat="server" id="operand1" /> +
<asp:TextBox runat="server" id="operand2" /><br />
<asp:Button type="submit" runat="server" Text="Submit" /><br />
The DataBound result = <%# Int32.Parse(operand1.Text) + Int32.Parse(operand2.Text) %>
</form>