티스토리 뷰
public class Paging
{
/// <summary>
/// 현재 페이지 번호
/// </summary>
public long CurrentPageNumber { get; set; }
/// <summary>
/// 총 페이지 갯수
/// </summary>
public long TotalPage { get; set; }
/// <summary>
/// 시작 페이지 번호
/// </summary>
public long StartPageNumber { get; set; }
/// <summary>
/// 끝 페이지 번호
/// </summary>
public long EndPageNumber { get; set; }
/// <summary>
/// 페이징 처리를 한다.
/// </summary>
/// <param name="totalRows">총 행의 수</param>
/// <param name="pageSize">한 페이지에 출력할 행의 수</param>
/// <param name="currentPage">현재 페이지 번호</param>
/// <param name="blockSize">페이징 수</param>
public Paging(long totalRows, long pageSize, long currentPage, long blockSize)
{
long totalPage = (long)Math.Ceiling((double)totalRows / pageSize);
long currentPageBlock = (long)Math.Ceiling((double)currentPage / blockSize);
long startPageNumber = ((currentPageBlock - 1) * blockSize) + 1;
long endPageNumber = (startPageNumber + blockSize) - 1 <= totalPage ? (startPageNumber + blockSize) - 1 : totalPage;
this.CurrentPageNumber = currentPage;
this.TotalPage = totalPage;
this.StartPageNumber = startPageNumber;
this.EndPageNumber = endPageNumber;
}
}
View]
<%
string uri = string.Format("/{0}/{1}?"
, ViewContext.Controller.ValueProvider.GetValue("controller").RawValue
, ViewContext.Controller.ValueProvider.GetValue("action").RawValue);
string IDx = string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["IDx"]) ? ViewData["FixedIDx"].ToString() : HttpContext.Current.Request.QueryString["IDx"];
string search = string.Format("&searchType={0}&searchWord={1}&IDx={2}"
, HttpContext.Current.Request.QueryString["searchType"]
, HttpContext.Current.Request.QueryString["searchWord"]
, IDx);
string preLink = Model.CurrentPageNumber > 1 ? uri + "currentPageNumber=" + (Model.CurrentPageNumber - 1) + search : "javascript:alert('이전 페이지가 존재하지 않습니다.')";
string nextLink = Model.CurrentPageNumber < Model.TotalPage ? uri + "currentPageNumber=" + (Model.CurrentPageNumber + 1) + search : "javascript:alert('다음 페이지가 존재하지 않습니다.')";
%>
<!-- previous -->
<a class="pg_btn_pre" href="<%= preLink %>" title="이전"><span class="ar1"></span></a>
<% for (int i = Model.StartPageNumber; i <= Model.EndPageNumber; i++) { %>
<% if(Model.CurrentPageNumber == i) { %>
<strong><%= i %></strong>
<% } else { %>
<a href="<%= uri %>currentPageNumber=<%= i %><%= search %>"><%= i %></a>
<% } %>
<% } %>
<!-- next -->
<a class="pg_btn_next" href="<%= nextLink %>" title="다음"><span class="ar2"></span></a>
Query]
/*********************************************************************
Name : up_m_notice_List
DB : totodisk_m
Auth : 장정훈
Date : 2015-09-08
Desc : 공지사항 목록을 가져온다.
state : 노출 여부 : 사용안함(2)/사용함(1)
isTop : 상위 고정 : 고정(true)/비고정(false)
declare @TotalRows bigint
set @TotalRows = 0
exec up_m_notice_List 1, 2, @TotalRows output
select @TotalRows
*********************************************************************/
alter procedure [dbo].[up_m_notice_List]
@CurrentPage bigint
, @PageSize bigint
, @TotalRows bigint output
as
begin
declare @Data table (
rn bigint
, idx bigint
, header varchar(100)
, title varchar(255)
, contents text
, regdate datetime
)
insert into @Data
select
row_number() over(order by idx desc) as rn
, idx
, header
, title
, contents
--, istop
, regdate
from m_notice with(nolock)
where state = 1
select *
from @Data
where rn > (@CurrentPage - 1) * @PageSize and rn <= @CurrentPage * @PageSize
-- 총 Rows
select @TotalRows=count(*) from @Data
end
- Total
- Today
- Yesterday
- FileUpload
- In App Purchase
- 앱 스토어
- System.Diagnostics
- mssql
- 명령어
- hyper-v
- html tag
- await
- 상품 등록
- MainActor
- async
- Task
- nl2br
- 공백제거
- App Store
- system.io
- trim
- 제품 등록
- 진수 변환
- .submit()
- 문자 자르기
- 특정 문자를 기준으로 자르기
- 아이폰
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |