Click here to Skip to main content
14,930,183 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to find out the last page index in for repeater cntrol..i am using 3tier architecture.

protected void btnLast_Click(object sender, EventArgs e)
           string searchText = txtSearch.Text;
           int businessType = Convert.ToInt32(ddlBusinessCategory.SelectedItem.Value);
           rptBusinessInfo.DataSource = BusinessSearchManager.SearchBusinessInfosPaged(searchText, businessType, ++currentIndex, 10);


in the place of currenindex what can i replace?

1 solution

Check this below logic


Total Record = 83;
Page Size = 10;


Value = Convert.toInt32(Total Record / Page Size);

if ((Value * 10)  <= Total Record)
	Last Page = Value;
	Last Page = Value + 1;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900