The
term polymorphic used here implies that we can have multiple methods of name
GetData(), differing in their signatures. Hence, we may also say that the GetData()
method is overloaded. We would use these methods throughout this book for all the
subsequent chapters that would require data retrieval.
Using the Object Data Source Control
To use the Object data source control:
1. Create a new web application in Visual Studio, open the default.aspx .file
and then switch to design view mode.
2. Now, add the ObjectDataSource control by dragging it from the toolbox. An
ObjectDataSource control with the default name of ObjectDataSource1 is
added to the web page.
3. We now require a data bound control to which we would bind the data
using this control. We will choose the GridView control for this and drag
one from the toolbox onto the web page. The default name of the control is
GridView1.
4. The next step is to configure the ObjectDataSource control.
??? ??? ???
Introduction to Data Binding in ASP.NET
[ 16 ]
5. We associate the Object data source control to the GridView Control
and set its DataSource property to the ObjectDataSource Control that we
have added in our web page. The following screenshot illustrates how
we associate the data source for the GridView control to our
ObjectDataSource control.
Pages:
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37