Sql Paging On List view:-
This is a light wait paging that increase the performance of you page.
to create this page i have taken one listview on each next/prev commend i am submitting the page and fatch the records based on the clicked event.
Basically i have used top exection query to show only respective records. below is my code will may be helps you.
to download the source code click here
This is a light wait paging that increase the performance of you page.
to create this page i have taken one listview on each next/prev commend i am submitting the page and fatch the records based on the clicked event.
Basically i have used top exection query to show only respective records. below is my code will may be helps you.
using (SqlConnection Sqlcon = new SqlConnection(ConnectionString().ToString()))
{
int Num = Take - Record;
string Sql = "Select top " + Record + " * from tempPage where NOT Pageid IN (Select top " + Num + " Pageid from tempPage)";
Sqlcon.Open();
SqlCommand Sqlcmd = new SqlCommand(Sql, Sqlcon);
SqlDataReader Sqldr = Sqlcmd.ExecuteReader();
if (Sqldr != null)
{
dtList.DataSource = Sqldr;
dtList.DataBind();
}
Sql = "Select Count(*) from tempPage";
if (Sqlcon.State == ConnectionState.Open)
Sqlcon.Close();
Sqlcon.Open();
SqlCommand SqlCmd = new SqlCommand(Sql, Sqlcon);
int TotRecord = Convert.ToInt32(SqlCmd.ExecuteScalar());
lbtnNext.Visible = (TotRecord > (Take)) ? true : false;
lbtnPrev.Visible = (Take <= Record) ? false : true;
}
to download the source code click here
No comments:
Post a Comment