Pedimentation code for the DataList control

xiaoxiao2021-03-17  228

This code is very common, it is also very practical!

Public void getMovlist () // Related categories of film {string strsql = "SELECT * FROM FILM where typeid = '" typeid "' and member = 0 ORDER BY DATEANDTIME DESC";

SqlDataAdapter Sqldapter = New SqlDataAdapter (strsql, movieconnsql); Dataset Datset = New DataSet ();

Try {Sqldapter.Fill (Datset, "Film");

PagedDataSource Objpage = new pagedDataSource (); objpage.datasource = datset.tables ["film"]. Defaultview, DEFAULTVIEW;

Objpage.Allowpaging = true; Objpage.pagesize = 10;

Int currpage; if (Request.QueryString ["page"]! = null) {currpage = convert.Toint32 (Request.QueryString ["page"]);} else {currpage = 1;}

Objpage.currentpageIndex = currpage-1;

if (! ObjPage.IsFirstPage) {HypPrv.NavigateUrl = Request.CurrentExecutionFilePath Convert.ToString (CurrPage-1) "& TypeID =" TypeID "Page =?";} if (ObjPage.IsLastPage!) {HypNext.NavigateUrl = REQUEST.CURRENTEXECUTIONFILEPATH "? Page =" Convert.TOSTRING (CURRPAGE 1) "& TypeId =" TypeId;}

DLMovlist.dataSource = Objpage; dlmovlist.database ();} catch {}}

转载请注明原文地址:https://www.9cbs.com/read-129707.html

New Post(0)