Get the App
SLTechnology News&Howtos  ›  Development  › 

How to deal with Line Command and Page in ASP.NET

Shulou Source: shulou.com Published: 2022-06-03 06:18:58 10月11日 Update

This article mainly introduces how to deal with line commands and paging in ASP.NET. It is very detailed and has a certain reference value. Friends who are interested must finish reading it.

1. Line command processing

(1) background code: operation line

/ / if it comes from the function operation in the html response

If (e.CommandNameplate = "addAge") {

/ / get the line number

Int index= ((ListViewDataItem) e.Item) DispalyIndex

/ / get the primary key value of the current operation line

/ / DataKeys stores all the ID and fetches the index ID

Guid id= (Guid) ListView1.DataKeys [index] .value

Table Adapter adapter=new Table Adapter ()

Adpter. Custom database function addAge

/ / data binding

ListView.DataBing ()

}

(2) sort

CommandName= "Sort"

CommandArgument= "ID"

Internal sorting, low efficiency

2. DataPager paging

PageControlID: which ListView is paged

Advanced pagination:

Query subquery

Select* from

(Select id,name,age,row_number () over (order by id) rownum from T_Users) t

Where t.rownum > 11and t.rownum@startRowIndex and t.rowRow

Tags: Data database method command processing content function article sorting query generation configuration advanced two code value information interest parameter background Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Docker MySQL Shulou Information macOS