DataReader isn't the easiest choice for paging and sorting. This article
explains it all for you.
http://dotnetjunkies.com/Article/3F9...079430EB2.dcik
Regards
John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"weird0" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
Below is the code I wrote but it aint working.... :
It throws an exception on DataBind() statement that "the source does
not support server-side paging".
PLz Help. Really stuck.
protected void Button1_Click(object sender, EventArgs e)
{
int AtmtransId=-1;
if (Session["CustomerId"]!=null)
AtmtransId=DataAccessLayer.ATMManager.getATMTransactionsID(Session["Custome*
rId"].ToString(),AccNamesList.SelectedItem.Text);
string Query = "SELECT atmtrans_date AS Date,atmtrans_branch
AS Branch,atmtrans_type AS Type,atmtrans_amount AS Amount FROM
ATM_Transactions WHERE atmtrans_id=@ATMTRANSID";
SqlConnection sqlconnection = new SqlConnection(@"Data
Source=.
\SQLEXPRESS;AttachDbFilename=|DataDirectory|\BankingDb.mdf;Integrated
Security=True;User Instance=True");
SqlCommand cmd = new SqlCommand(Query,sqlconnection);
cmd.Parameters.AddWithValue("@ATMTRANSID",AtmtransId);
sqlconnection.Open();
SqlDataReader reader=cmd.ExecuteReader();
sqlconnection.Close();
GridView1.DataSource=reader;
GridView1.DataBind();
sqlconnection.Close();
}
GridView's AllowPaging Property is set to true with some function
defined to its corresponding property.