tailieunhanh - ASP.NET 4 Unleased - p 54

Using the GridView Control ” SelectCommand=”SELECT Id,Title,Director FROM Movies” Runat=”server” / The page in Listing includes an UpdatePanel control. Because the GridView is contained in the UpdatePanel, the page containing GridView is not posted back to the server when you page through GridView. The page in Listing displays the current time at the top of the page. When you page through the records rendered by the GridView control, the time does not change. Only the. | 504 CHAPTER 11 Using the GridView Control asp ScriptManager ID sm1 runat server T asp UpdatePanel ID up1 runat server ContentTemplate asp GridView id grdMovies DataSourceID srcMovies AllowPaging true EnableSortingAndPagingCallbacks true PageSize 3 Runat server ContentTemplate asp UpdatePanel asp SqlDataSource id srcMovies ConnectionString ConnectionStrings Movies SelectCommand SELECT Id Title Director FROM Movies Runat server div form body html The page in Listing includes an UpdatePanel control. Because the GridView is contained in the UpdatePanel the page containing GridView is not posted back to the server when you page through GridView. The page in Listing displays the current time at the top of the page. When you page through the records rendered by the GridView control the time does not change. Only the contents of the GridView control are modified. Customizing the Paging Interface By default when paging is enabled GridView renders a list of page numbers at the bottom of the grid. You can modify the user interface for paging through records by modifying the GridView control s PagerSettings property. For example the page in Listing contains a GridView that renders First Previous Next and Last links at both the top and bottom of GridView see Figure . From the Library of Wow eBook Gridview Control Fundamentals 505 O http locnlhost 4790 - Pngp Grid Previous Next - Mozilln Firefox fn X Id Tide Director 4 Jaws Steven Spielberg 5 Gbust Jen y Zucker 7 F one st Gump Robert Zemeckis 11 FIGURE Modifying pager settings. LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD html xmlns http 1999 xhtml head id Head1 runat server title Page Grid Previous Next title head body form id form1 runat server div asp GridView id grdMovies DataSourceID srcMovies AllowPaging true PageSize 3 PagerSettings-Mode NextPreviousFirstLast .