MVC3 使用mvcpager實現資料分頁

2021-06-16 12:02:14 字數 1334 閱讀 2496

2:寫好公共的分頁** 引用 webdiyer.webcontrols.mvc;

int pagesize = 10;

/// /// 分頁(每頁記錄數預設)

///

/// 泛型tentity實體

/// 頁碼

/// 頁資料列表

public pagedlistgetpagedata(int? pageid, iqueryablequery)

/// /// 分頁** ///

/// 泛型tentity實體

/// 頁碼

/// 每頁顯示條數

/// 頁資料列表

public pagedlistgetpagedata(int? pageid, int pagesize, iqueryablequery)

在 controller頁面:**如下:

//分頁頁面

public actionresult index(int? id = 1)

//獲取資料集

public listgetuserlist()

,new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

new user(),

} /// /// 定義實體

///

public class user

public string name

public string ***

public string phone

public string address

}

頁面**:

idname

***phone

address@}

共 @model.totalitemcount 條,頁 @model.currentpageindex/ @model.totalpagecount

@ajax.pager(model, new pageroptions()

, new ajaxoptions()

)

MVC3 使用NPOI匯出excel

此次專案中使用的是npoi的1.25版本,專案是mvc3,在這裡只貼上controller部分的 1 using npoi.hssf.usermodel 2using npoi.ss.usermodel 1 2 匯出excel 3 4 聯盟id 5 遊玩時間 6 7public actionresu...

學習封裝 MVC 3

一 配置載入類 1 建立配置路由 return array ctrl index action index 2 控制器層 1.判斷配置檔案是否存在 2.判斷當前配置是否存在 3.快取配置 載入單一配置 static public conf array static public function g...

MVC3學習總結

本文是閱讀了scottgu s blog來記錄的,外加自己的學習心得。一 razor razor是乙個新的檢視引擎,它實現了快速,流暢的編碼流程,使得檢視模板跟簡潔乾淨。1 靈活的選擇。add view.新建檢視模板的時候你可以選擇razor cshtml 模板檢視,或aspx c 模板檢視。2 r...