2012-04-15 62 views
0

我是ASP.NET新手。ASP.NET Gridview to hanlde刪除,排序和分頁記錄

我正在設計一個使用DataGrid的ASP.NET頁面,在那裏我會做以下任務。請建議什麼是最好的方法。從DB

1)顯示的記錄上的網格如下(使能分頁)

Cloum1|Colum2|Column3|<CheckBox> 
-------------------------------- 
Colva1|Colva4|Colvaa3|<CheckBox> 
Colva1|Colva4|Colvaa3|<CheckBox> 
Colva1|Colva4|Colvaa3|<CheckBox> 
Colva1|Colva4|Colvaa3|<CheckBox> 
Colva1|Colva4|Colvaa3|<CheckBox> 
Colva1|Colva4|Colvaa3|<CheckBox> 
Colva1|Colva4|Colvaa3|<CheckBox> 
Colva1|Colva4|Colvaa3|<CheckBox> 

      [DELETE Button] 

{Solution proposed: Upon load event of the page bind grid with List of entities retrieved from the DB on grid using DataBind(), enable sorting, and paging (currently doing paging and sorting on post back events :()} 
{Required help: best approach in doing paging and sorting on the gird with considering performance??} 


2)Deleting records : 
    -User should be able to navigate to multiple pages on the grid, and should be able to check records which he want to delete form 
    {Solution proposed: Upon load event of the page bind grid with List of entities retrieved from the DB on grid using DataBind()} 
    -After clicking on Delete button all the records from the DB should be removed. 
    {Solution proposed- on Delete button submit click run delete operation using ADO.NET via SP on all the selected records.} 
    {Required help: Best approach in this case, how to track the number of records selected for Delete on multiple pages} 
    -Incase user sorts the records on the page they shouldn't do a post back instead maintain the state of whether records are checked for delete. 
    {Required help: unsure on how to handle this??} 

感謝。

回答