ObjectDataSource enables user to define their own custom classes to bind data to the controls.
To use a class as an ObjectDataSource that class must have their own Insert, Delete, Update, and Select method. One important point that must be noted that ObjectDataSource doesn't support batch updation of the data, so the update method must support updation of the record one by one.
Some Important Properties of ObjectDataSource Control
|
InsertMethod, InsertParameters |
Gets or sets the name of the method and its parameter to perform insert operation.
|
UpdateMethod, UpdateParameters |
Gets or sets the name of the method and its parameter to perform update operation.
|
DeleteMethod, DeleteParameters |
Gets or sets the name of the method and its parameter to perform delete operation.
|
SelectMethod, SelectParameters |
Gets or sets the name of the method and its parameter to perform select operation.
|
ConvertNullToDBNull |
true/false. Used to indicate whether null parameter passed to the method should be converted to System.DBNull.
|
DataObjectTypeName |
Gets or sets the class name that is used to perform insert, update, delete, and select operation.
|
EnablePaging |
true/false. True if paging is supported by the method.
|
FilterExpression, FilterParameters |
Gets or sets the filter expression and filter parameter to filter the select operation.
|
SelectCountMethod |
Gets or sets the method name that is used to count the selected records (selected by SelectMethod method).
|
SortParameterName |
Gets or sets the name of the input parameter used to sort selected record.
|
StartRowIndexParameterName |
Works only if EnablePaging=true. Gets or sets the name of the parameter of select method that is used as starting record from where to retrieve records.
|
ConvertNullToDBNull |
true/false. Used to indicate whether null parameter passed to the method should be converted to System.DBNull.
|