Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 21st, 2004, 05:52 PM
Registered User
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataGrid Binding

Thank you in advance..Having an issue with custom paging when the form loads the data binds just fine when I click on thelink for the next set of data the PageIndexChanged doesnt seem to fire

 public void PageIndexChanged(object sender, DataGridPageChangedEventArgs e)
{
CustomerListGrid.CurrentPageIndex = e.NewPageIndex;
nPageIndex = CustomerListGrid.CurrentPageIndex * CustomerListGrid.PageSize;
LoadData(nPageIndex,CustomerListGrid.PageSize);
}
 public void LoadData(int nPageIndex, int nPageSize)
{
CustomerListGrid.DataSource = myCustomerList.GetCustomerList(nPageIndex,Customer ListGrid.PageSize);
CustomerListGrid.DataBind();
}
public SqlDataReader GetCustomerList(int nPageIndex, int nPageSize)
{

int nBaseProductID = nPageSize * nPageIndex;
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand myCommand = new SqlCommand("CustomerList", myConnection);

SqlParameter parameternPageSize = new SqlParameter("@nPageSize", SqlDbType.Int, 4);
parameternPageSize.Value = nPageSize;
myCommand.Parameters.Add(parameternPageSize);

SqlParameter parameternBaseProductID = new SqlParameter("@nPageIndex", SqlDbType.Int, 4);
parameternBaseProductID.Value = nBaseProductID;
myCommand.Parameters.Add(parameternBaseProductID);
myCommand.CommandType = CommandType.StoredProcedure;


myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConne ction);
return result;
}






Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Binding Using DataGrid hoailing22 ASP.NET 1.0 and 1.1 Basics 17 November 14th, 2006 02:17 AM
Datagrid binding two dropdown inkrajesh ASP.NET 1.0 and 1.1 Basics 0 July 18th, 2006 10:46 PM
Binding a datagrid on errors drono ASP.NET 1.0 and 1.1 Professional 3 June 9th, 2005 08:30 AM
Binding Data to a DataGrid RPG SEARCH ASP.NET 1.0 and 1.1 Basics 5 August 9th, 2004 02:27 PM
Binding an aarraylist to a datagrid Delano ADO.NET 2 September 22nd, 2003 05:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.