This is the most important saying of the ASP.NET series, including server controls, database operations, all controls related to operational data, will be used to DataBind, that is, the talk of data, which has begun to talk about ASP.NET The problem is. In fact, the concept of DataBind has been proposed for a long time. There is also an application in the ASP, but everyone is not very paying attention. But in ASP.NET, it has already been upgraded to a core height.
4.1 Simple introduction Database DataBind
Database includes three major methods, Repeater, DataList, and DataGrid, which are directly or indirectly derived from the WebControl base class in System.Web.ui.WebControls. These methods are content of data by HTML.
4.2 Establishing DATABIND
All DATABIND should be built with a database (note if you are C #, please pay attention to case you write) data binding, a method of the entire page and all controls, that is, he can be all When the control is used, when you build data binding, DataBind can be used as a child of the control, such as DataList1.Database (), such as page.Database, will bind the entire page. Database is often bound when it is loaded. The following example is this.
Protected Sub Page_Load (SRC As Object, E AS Eventargs) Database () End Sub
4.3 Start using a simple data binding
Look at this example: