User can bind the data with the controls of the forms. This process is known as data binding. There are two types of data binding in ASP.NET known as simple data binding and declarative data binding. Simple data binding In simple data binding, the control is bounded to a data set. The properties of the control are used for binding with the value. Depending on the control to be bounded, the binding’s property is set. Consider the following example where the Academic information of the student is bounded using various controls. Example to demonstrate the simple data binding in ASP.NET Consider an example where a windows form is used for displaying the details. Create a Windows form application in Visual studio. Add the windows form to the design view. Add three labels and corresponding textboxes to it. Add the labels as Name, Age and Location. Select the View, Properties Window in the application Select the first textbox and navigate to the properties window. Expand the DataBindings property. From the drop down list, select the Text property. Click on the Add Project Data Source from the drop down list. Add a connection to the database and select the appropriate table. Select Other Data Sources, Project data source, DataSet. Select the appropriate value and bind the textbox control with it. Press F5 or select Start debugging option. Execute the windows form and the following output is displayed. Declarative data binding The process of binding a component like listbox, DataGrid, record list with the dataset is known as declarative binding. When there is more than one element in the database, the declarative binding is used. Some of the controls used for the declarative data binding are listed below. DataGrid: The data from multiple records is displayed using the DataGrid view. The DataSource property of the control is used for binding the specific element data. ListBox: The data for a column from different dataset is displayed. The DataSource property is used for binding the control. The control binds to the specific element using the DisplayMember property. ComboBox: The DisplayMember property is used for binding the control to the specific data element. The DataSource property is used for binding the control to the data source. The following objects are needed for data binding in ASP.NET. The data accessed from the database is stored in the dataset. The data provider is used for accessing data through the command object The data adapter is used for selecting, updating, inserting, deleting the data using commands. Consider the following example to demonstrate the declarative data binding Create an ASP.NET web application in visual studio. Add a grid view control in the design view of the application In the source view, add the following code Code: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" > <Columns> <asp:BoundField DataField="studid" HeaderText="studid" SortExpression="studid" /> <asp:BoundField DataField="studname" HeaderText="studname" SortExpression="studname" /> <asp:BoundField DataField="marks" HeaderText="marks" SortExpression="marks"/> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ConnectionStrings:demoConnectionString1 %>" SelectCommand="SELECT * FROM [ result ] “> </asp:SqlDataSource> </div> </form> </body> </html> The above code is compiled and executed, the following output is generated.