7. GridView 컨트롤의 DataSourceID 속성 값을 ObjectDataSource 컨트롤의 ID 값으로 지정한 후 전체 완성된 소스는 다음과 같다. 직접 코드로 입력해도 결과는 같다.
▼ FrmObjectDataSource.aspx
<%@ Page Language=“C#” AutoEventWireup=“true” CodeBehind=“FrmObjectDataSource.aspx.cs” Inherits=“DevDataControl.FrmObjectDataSource” %> <!DOCTYPE html> <html xmlns=“http://www.w3.org/1999/xhtml"> <head runat=“server”> <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”/> <title>ObjectDataSource 컨트롤</title> </head> <body> <form id=“form1” runat=“server”> <div> <asp:GridView ID=“ctlMemoList” runat=“server” DataSourceID=“odsMemoList”></asp:GridView> <asp:ObjectDataSource ID=“odsMemoList” runat=“server” SelectMethod=“GetMemos” TypeName=“DevDataControl.FrmObjectDataSourceClass”></asp:ObjectDataSource> </div> </form> </body> </html>