FilterExpression, Gets or sets the data filtering string and parameters. SortParameterName Gets or sets the name of an input parameter that the command's stored procedure will use to sort data. The following code snippet shows a data source control enabled for data manipulation: The programming interface of this class is almost same as the SqlDataSource control. Following are two important aspects of binding business objects: The bindable class should have a default constructor, it should be stateless, and have methods that can be mapped to select, update, insert, and delete semantics.
The object must update one item at a time, batch operations are not supported. Let us go directly to an example to work with this control. The student class is the class to be used with an object data source. This class has three properties: It has a default constructor and a GetStudents method for retrieving data.
Add "StudentID", typeof System. Add "StudentName", typeof System. Add "StudentCity", typeof System. Create a new web site. Add a class Students. Build the solution so that the application can use the reference to the class.
Place an object data source control in the web form. Configure the data source by selecting the object. Select a data method s for different operations on data. In this example, there is only one method. Place a data bound control such as grid view on the page and select the object data source as its underlying data source.
At this stage, the design view should look like the following: Run the project, it retrieves the hard coded tuples from the students class. It is based on the SqlDataSource control and provides simpler programming interface. The following code snippet provides the basic syntax for the data source: However, it can also be used for performing insert, update, or delete operations.
This is done using the ADO. NET commands and parameter collection. Updates are problematic for Access databases from within an ASP. NET application might not have the permission to write to the database file.