Declare @start int
Declare @End int
Declare @FinalQuery nvarchar(4000)
Set @start = (@PageIndex - 1) * @Pagesize
Set @End = @PageIndex * @Pagesize
('Select * From
(
Select Row_Number() Over(Order by [ShipAuditID] desc) as RowID, *
From #AuditDetails ' + @Filter +
')K
Where RowID > ' + Cast(@start as varchar) + ' and RowID <=' + Convert(varchar, @End))
#region Paging Events
protected void btnfirst_Click(object sender, ImageClickEventArgs e)
{
lblpageinfo.Text = "Page 1";
BindAuditGrid();
}
protected void btnprevious_Click(object sender, ImageClickEventArgs e)
{
int PageIndex = 0;
PageIndex = Convert.ToInt16(lblpageinfo.Text.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).GetValue(1).ToString());
lblpageinfo.Text = "Page " + (PageIndex - 1).ToString();
BindAuditGrid();
}
protected void btnnext_Click(object sender, ImageClickEventArgs e)
{
int PageIndex = 0;
PageIndex = Convert.ToInt16(lblpageinfo.Text.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).GetValue(1).ToString());
lblpageinfo.Text = "Page " + (PageIndex + 1).ToString();
BindAuditGrid();
}
protected void btnlast_Click(object sender, ImageClickEventArgs e)
{
BLL_ShipAudits objShipAudit = null;
int Quotient = 0;
int Reminder = 0;
int pagesize = 0;
try
{
objShipAudit = new BLL_ShipAudits();
//string FilterValue = PrepareFilter();
string FilterValue = "";
TotalrecordsRecords = objShipAudit.Totalrecords(string.IsNullOrEmpty(FilterValue) ? string.Empty : FilterValue);
pagesize = Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["GridPageSize"].ToString());
Quotient = TotalrecordsRecords / pagesize;
Reminder = TotalrecordsRecords % pagesize;
if (Reminder > 0)
Reminder = 1;
Quotient = Quotient + Reminder;
lblpageinfo.Text = "Page " + Quotient.ToString();
BindAuditGrid();
}
catch (Exception)
{
throw;
}
}
#endregion
Declare @End int
Declare @FinalQuery nvarchar(4000)
Set @start = (@PageIndex - 1) * @Pagesize
Set @End = @PageIndex * @Pagesize
('Select * From
(
Select Row_Number() Over(Order by [ShipAuditID] desc) as RowID, *
From #AuditDetails ' + @Filter +
')K
Where RowID > ' + Cast(@start as varchar) + ' and RowID <=' + Convert(varchar, @End))
#region Paging Events
protected void btnfirst_Click(object sender, ImageClickEventArgs e)
{
lblpageinfo.Text = "Page 1";
BindAuditGrid();
}
protected void btnprevious_Click(object sender, ImageClickEventArgs e)
{
int PageIndex = 0;
PageIndex = Convert.ToInt16(lblpageinfo.Text.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).GetValue(1).ToString());
lblpageinfo.Text = "Page " + (PageIndex - 1).ToString();
BindAuditGrid();
}
protected void btnnext_Click(object sender, ImageClickEventArgs e)
{
int PageIndex = 0;
PageIndex = Convert.ToInt16(lblpageinfo.Text.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).GetValue(1).ToString());
lblpageinfo.Text = "Page " + (PageIndex + 1).ToString();
BindAuditGrid();
}
protected void btnlast_Click(object sender, ImageClickEventArgs e)
{
BLL_ShipAudits objShipAudit = null;
int Quotient = 0;
int Reminder = 0;
int pagesize = 0;
try
{
objShipAudit = new BLL_ShipAudits();
//string FilterValue = PrepareFilter();
string FilterValue = "";
TotalrecordsRecords = objShipAudit.Totalrecords(string.IsNullOrEmpty(FilterValue) ? string.Empty : FilterValue);
pagesize = Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["GridPageSize"].ToString());
Quotient = TotalrecordsRecords / pagesize;
Reminder = TotalrecordsRecords % pagesize;
if (Reminder > 0)
Reminder = 1;
Quotient = Quotient + Reminder;
lblpageinfo.Text = "Page " + Quotient.ToString();
BindAuditGrid();
}
catch (Exception)
{
throw;
}
}
#endregion
No comments:
Post a Comment