Data binding expression : Binding expression « Data Binding « ASP.Net






Data binding expression



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" Debug="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Data-bound Expressions</title>
</head>
<body>
    <form id="form1" runat="server">
        <h2>Today is 
        <asp:Label ID="Today" runat="server" Text="<%# DateTime.Now %>" />
        </h2>
    </form>
</body>
</html>

File: Default.aspx.cs

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataBind();
    }
}

 








Related examples in the same category

1.Binding to a Method