This preview shows page 1. Sign up to view the full content.
Unformatted text preview: " />
<asp:BoundField HeaderText="State" DataField="state" SortExpression="state" />
<asp:BoundField HeaderText="Zip Code" DataField="zip" SortExpression="zip" />
<asp:CheckBoxField HeaderText="Contract" SortExpression="contract" DataField="contract" />
<asp:SqlDataSource ID="SqlDataSource1" Runat="server" SelectCommand="SELECT [au_id], [au_lname],
[au_fname], [phone], [address], [city], [state], [zip], [contract] FROM [authors]"
UpdateCommand="UPDATE [authors] SET [au_lname] = @au_lname, [au_fname] = @au_fname, [phone] = @phone,
[address] = @address, [city] = @city, [state] = @state, [zip] = @zip, [contract] = @contract WHERE [au_id] =
ConnectionString="<%$ ConnectionStrings:Pubs %>" />
</html> 24 ObjectDataSource
Instead of a ConnectionString property, ObjectDataSource exposes a
TypeName property that specifies an object type (class name) to
instantiate for performing data operations. Similar to the command
properties of SqlDataSource, the ObjectDataSource control supports
properties such as SelectMethod, UpdateMethod, InsertMethod,
and DeleteMethod for specifying methods of the associated type to
call to perform these data operations.
Declarative binding to data components
Leverage middle-tier data access components
Keep data access code separate from UI layer Two-way data binding
SelectMethod, InsertMethod, UpdateMethod, and DeleteMethod Optional caching of query results
Parameterized operation Key OjbectDataSource Properties
Name Description TypeName Type name of data component SelectMethod Method called on data component to perform queries InsertMethod Method called on data component to perform inserts UpdateMethod Method called on data component to perform updates DeleteMethod Method called on data component to perform deletes EnableCaching Specifies whether caching is enabled (default = false) 25 ObjectDataSource Example
<%@ Page Language="C#" %>
<form id="form1" runat="server">
<asp:DropDownList ID="DropDownList1" Runat="server" DataSourceID="ObjectDa...
View Full Document
This note was uploaded on 04/04/2014 for the course CS 5950 taught by Professor Staff during the Summer '08 term at Western Michigan.
- Summer '08