TAILIEUCHUNG - ASP.NET 4 Unleased - p 59

Using the GridView Control .categories h1 { font:bold 16px Arial, Sans-Serif; } .movies { margin-left:20px; margin-bottom:10px; width:100%; } Nested Master/Detail ” SelectCommand=”SELECT Title,Director FROM Movies WHERE CategoryId=@CategoryId” Runat=”server” From | 554 CHAPTER 11 Using the GridView Control .categories hl font bold 16px Arial Sans-Serif .movies margin-left 20px margin-bottom 10px width 100 style title Nested Master Detail title head body form id form1 runat server div asp GridView id grdMovies DataSourceID srcMovieCategories OnRowDataBound grdMovieCategories_RowDataBound AutoGenerateColumns false CssClass categories ShowHeader false GridLines none Runat server Columns asp TemplateField ItemTemplate h1 Eval Name h1 asp GridView id grdMovies DataSourceId srcMovies CssClass movies GridLines none Runat server asp SqlDataSource id srcMovies ConnectionString ConnectionStrings Movies SelectCommand SELECT Title Director FROM Movies WHERE CategoryId @CategoryId Runat server SelectParameters asp Parameter Name CategoryId SelectParameters From the Library of Wow eBook Extending the GridView Control 555 asp SqlDataSource ItemTemplate asp TemplateField Columns asp GridView 11 asp SqlDataSource id srcMovieCategories ConnectionString ConnectionStrings Movies SelectCommand SELECT Id Name FROM MovieCategories Runat server div form body html The grdMovieCategories_RowDataBound method handles the RowDataBound event. This event handler grabs the movie category ID from the current row s Dataltem property. Next it retrieves the SqlDataSource control contained in the grdMovieCategories TemplateField. Finally it assigns the movie category ID to a parameter contained in the SqlDataSource control s SelectParameters collection. NOTE You must use the FindControl method to get the SqlDataSource control from the TemplateField. The templates in a TemplateField each create their own naming containers to prevent naming collisions. The FindControl method enables you to search a naming container for a control with a matching ID. Extending the GridView Control Like any other control in the Framework if you don t like any aspect of the GridView control you always have the option of extending the control. In this section you learn how to .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.