Kỹ thuật phân trang trong GridView ppt

3 718 0
Kỹ thuật phân trang trong GridView ppt

Đang tải... (xem toàn văn)

Thông tin tài liệu

Kỹ thuật phân trang trong GridView để Paging trong GridView thì phải có các điều kiện sau: trong code aspx: <asp:GridView ID="GridView1" AllowPaging="true" PageSize="10" PageSize là số lượng bản ghi trên 1 trong của GridView AllowPaging là cho phép GridView phân trang mở Design click chuột trái vào GridView > chọn Properties Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. Click chuột đúp sự kiện PageIndexChanging nó sẽ Gen ra trong code behind thế này Viết tiếp 1 hàm Bind dữ liệu từ Database lên GridView Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. trong sự kiện GridView1_PageIndexChanging viết GridView1.PageIndex = e.NewPageIndex; mục đích là set lại trang hiện tại cho GridView sau đó gọi lại ngay hàm BindGrid() để lấy dữ liệu mới. Để trang web được load nhanh hơn, chúng ta sẽ sử dụng Ajax ở đây: Trong code aspx thêm dưới thẻ form: ? code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> <p>Loading</p> </ProgressTemplate> </asp:UpdateProgress> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:GridView ID="GridView1" runat="server" PageSize="10" AllowPaging="true" onpageindexchanging="GridView1_PageIndexChanging" AutoGenerateColumns="false"> <Columns> </Columns> </asp:GridView> </ContentTemplate> </asp:UpdatePanel> Như vậy khi áp dụng Ajax website của chúng ta load nhanh hơn rất nhiều. Download Demo Project Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. . Kỹ thuật phân trang trong GridView để Paging trong GridView thì phải có các điều kiện sau: trong code aspx: <asp :GridView ID=" ;GridView1 " AllowPaging="true". PageSize="10" PageSize là số lượng bản ghi trên 1 trong của GridView AllowPaging là cho phép GridView phân trang mở Design click chuột trái vào GridView > chọn Properties Generated. Software http://www.foxitsoftware.com For evaluation only. trong sự kiện GridView1 _PageIndexChanging viết GridView1 .PageIndex = e.NewPageIndex; mục đích là set lại trang hiện tại cho GridView sau đó gọi lại ngay hàm

Ngày đăng: 21/06/2014, 09:20

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan