CodingManiac
CodingManiac

Reputation: 123

Why the server side variable is not getting bound to the .aspx textbox?

    Public Class frmFMECA
    Inherits System.Web.UI.Page

    Public LastFailureDate As String

and using it like this in .aspx

 <asp:TextBox ID="txtLastFailureDate_GR" Text="<%= this.LastFailureDate %>" runat="server"></asp:TextBox>

but it doesn't show that anything but <%= this.LastFailureDate %> inside the textbox.

Upvotes: 0

Views: 130

Answers (1)

VDWWD
VDWWD

Reputation: 35564

You need to use a DataBinding Expression.

Text='<%# this.LastFailureDate %>'

And if the TextBox is not inside a GridView, Repeater etc you need to manually call DataBind() in the Page_Load

protected void Page_Load(object sender, EventArgs e)
{
    DataBind();
}

Upvotes: 1

Related Questions