TAILIEUCHUNG - ASP.NET 4 Unleased - p 101

Các trang trong Ví dụ 20,23 chứa một điều khiển FormView và kiểm soát một GridView. Bạn có thể sử dụng FormView để ghi chèn bộ phim mới vào cơ sở dữ liệu. Việc kiểm soát FormView là ràng buộc với một điều khiển ObjectDataSource đại diện cho lớp trang. | 974 CHAPTER 20 Data Access with LINQ to SQL The page in Listing contains a FormView control and a GridView control. You can use FormView to insert new movie records into the database. The FormView control is bound to an ObjectDataSource control that represents the Movie class. LISTING Standard @ Page Language C Trace true DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD html xmlns http 1999 xhtml head runat server title Insert Movie title head body form id form1 runat server div asp FormView id frmMovie DataSourceID srcMovies DefaultMode Insert Runat Server InsertItemTemplate asp Label id lblTitle Text Title AssociatedControlID txtTitle Runat server br asp TextBox id txtTitle Text Bind Title Runat server br br asp Label id lblCategory Text Category AssociatedControlID ddlCategory Runat server br asp DropDownList id ddlCategory DataSourceId srcMovieCategories From the Library of Wow eBook Performing Standard Database Commands with LINQ to SQL 975 SelectedValue Bind CategoryId DataTextField Name DataValueField Id Runat server asp ObjectDataSource id srcMovieCategories TypeName MovieCategory SelectMethod Select Runat Server br br asp Label id lblDirector Text Director AssociatedControlID txtDirector Runat server br asp TextBox id txtDirector Text Bind Director Runat server br br asp Label id lblDescription Text Description AssociatedControlID txtDescription Runat server br asp TextBox id txtDescription Text Bind Description TextMode MultiLine Columns 60 Rows 3 Runat server br br asp Label id lblDateReleased Text Date Released AssociatedControlID txtDateReleased Runat server 20 From the Library of Wow eBook 976 CHAPTER 20 Data Access with LINQ to SQL br asp TextBox id txtDateReleased Text Bind DateReleased Runat server br br asp Button id btnInsert Text Insert CommandName Insert Runat server InsertItemTemplate asp FormView hr asp GridView id grdMovies DataSourceID .

TÀI LIỆU MỚI ĐĂNG