{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Propertynameselectedvalue aspcontrolparameter

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

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" /> </Columns> </asp:GridView> <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] = @au_id" ConnectionString="<%$ ConnectionStrings:Pubs %>" /> </form> </body> </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#" %> <html> <body> <form id="form1" runat="server"> <asp:DropDownList ID="DropDownList1" Runat="server" DataSourceID="ObjectDa...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online