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 asp.net for repeater cntrol..i am using 3tier architecture.

C#
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);

           rptBusinessInfo.DataBind();
       }


in the place of currenindex what can i replace?
Posted

1 solution

Check this below logic

//e.g. 

Total Record = 83;
Page Size = 10;

//Solution:

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

if ((Value * 10)  <= Total Record)
	Last Page = Value;
else
	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