ASP.NET Gridview可对记录进行删除、排序和分页

ASP.NET Gridview可对记录进行删除、排序和分页,asp.net,datagridview,pagination,postback,gridview-sorting,Asp.net,Datagridview,Pagination,Postback,Gridview Sorting,我是ASP.NET的新手 我正在使用DataGrid设计ASP.NET页面,我将在其中执行以下任务。请建议最好的方法 1) 在网格上显示数据库中的记录,如下所示(启用分页) Cloum1 | Colum2 | Column3| -------------------------------- Colva1 | Colva4 | Colvaa3| Colva1 | Colva4 | Colvaa3| Colva1 | Colva4 | Colvaa3| Colva1 | Colva4 | Colv

我是ASP.NET的新手

我正在使用DataGrid设计ASP.NET页面,我将在其中执行以下任务。请建议最好的方法

1) 在网格上显示数据库中的记录,如下所示(启用分页)

Cloum1 | Colum2 | Column3|
--------------------------------
Colva1 | Colva4 | Colvaa3|
Colva1 | Colva4 | Colvaa3|
Colva1 | Colva4 | Colvaa3|
Colva1 | Colva4 | Colvaa3|
Colva1 | Colva4 | Colvaa3|
Colva1 | Colva4 | Colvaa3|
Colva1 | Colva4 | Colvaa3|
Colva1 | Colva4 | Colvaa3|
[删除按钮]
{建议的解决方案:加载页面事件时,使用DataBind()将网格上的DB检索到的实体列表绑定到网格上,启用排序和分页(当前正在对回发事件进行分页和排序:())
{所需帮助:在考虑性能的情况下在网格上进行分页和排序的最佳方法??}
2) 删除记录:
-用户应该能够导航到网格上的多个页面,并且应该能够检查他想要删除表单的记录
{建议的解决方案:使用DataBind()从DB on grid检索的实体列表绑定页面网格的OnLoad事件}
-单击删除按钮后,应删除数据库中的所有记录。
{建议的解决方案-在“删除”按钮提交时,单击“通过SP使用ADO.NET运行删除操作”。}
{所需帮助:本例中的最佳方法,如何跟踪在多个页面上选择删除的记录数}
-如果用户对页面上的记录进行排序,则不应执行回发操作,而应维护是否检查记录以进行删除的状态。
{所需帮助:不确定如何处理此问题??}

谢谢。

在文章的ASP.Net网格视图中,有一个逐步执行编辑/更新、删除的过程


要在分页检查时保持复选框状态,请执行以下操作:

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??}