Popular Posts
Enable SSL connection for Jsoup import org.jsoup.Connection; import org.jsoup.Jsoup; import javax.net.ssl.*; import java.io.IOException; import java.security.KeyManagement... LogonUser Function : impersonate a windows user // This sample demonstrates the use of the WindowsIdentity class to impersonate a user. // IMPORTANT NOTES:  // This sample can be run only ... Build an OpenVPN server on android device Preparation An android device, in this case, Sony xperia Z is used Root permission required Linux Deploy for deploy i...
Stats
DataList paging
//利用PageDataSource來做分頁功能
PagedDataSource pds = new PagedDataSource();
//將PageDataSource綁定SqlDataSource
pds.DataSource = SqlDataSource1.Select(DataSourceSelectArguments.Empty);
pds.AllowPaging = true;
// 分頁大小
pds.PageSize = 6;

int PageIndex;
//分頁參數
if (!string.IsNullOrEmpty(Request.QueryString["Page"]) && int.TryParse(Request.QueryString["Page"], out PageIndex))
{
    PageIndex = Convert.ToInt32(Request.QueryString["Page"]);
}
else
{
    PageIndex = 1;
}

pds.CurrentPageIndex = PageIndex - 1;

// 最後一頁
if (!pds.IsLastPage)
{
    hlNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(PageIndex + 1);
    if (Request.QueryString["type"] != null) hlNext.NavigateUrl += "&type=" + Request.QueryString["type"];
}
else
{
    hlNext.Visible = false;
}


//將DataList綁定PageDataSource
this.DataList1.DataSource = pds;
this.DataList1.DataBind();