首页 > 代码库 > 最简单的数据绑定

最简单的数据绑定

前台代码:

1 <form id="form1" runat="server">2     <div>3         <asp:Label ID = "lable1" runat ="server" Height = "29px" Width = "666px" Text = ‘<%#name%>‘></asp:Label>4     </div>5 </form>
View Code

后台代码:

public String name = "张三";    protected void Page_Load(object sender, EventArgs e)    {        lable1.DataBind();//注意数据绑定    }
View Code

真是没有更简单的东西了,o(︶︿︶)o