Hi. Thanks for replying. Here is the full procedure I have, so, maybe it can
give more details and help:
private void changePage(obje ct source,
System.Web.UI.W ebControls.Data GridPageChanged EventArgs e)
{
dgCustInfo.Curr entPageIndex = e.NewPageIndex;
SqlConnection conn = new SqlConnection
(ConfigurationS ettings.AppSett ings["SqlConnectionS tring"]);
conn.Open();
SqlCommand dataCommand = new SqlCommand();
dataCommand.Con nection = conn;
dataCommand.Com mandText = "SELECT GEM.customers.n ame AS [Institution
Name], "
+ "GEM.customers. CustomerSince AS [Customer Since], "
+ "GEM.contacts.n ame_first AS [First Name], "
+ "GEM.contacts.n ame_last AS [Last Name], "
+ "GEM.contacts.t itle AS [Contact Title], "
+ "GEM.customers. address_1 AS Address, "
+ "GEM.customers. city AS City, "
+ "GEM.customers. state AS State, "
+ "GEM.customers. province AS Province, "
+ "GEM.customers. zip_code AS [Zip Code], "
+ "GEM.customers. postal_code AS [Postal Code], "
+ "GEM.customers. country AS Country, "
+ "GEM.customers. phone AS Phone, "
+ "GEM.contacts.e mail AS [E-Mail Address], "
+ "GEM.customers. cust_id "
+ "FROM GEM.customers INNER JOIN GEM.config_user names ON "
+ "GEM.customers. cust_id = GEM.config_user names.cust_id INNER JOIN "
+ "GEM.contac ts ON GEM.config_user names.contact_i d =
GEM.contacts.co ntact_id ORDER BY GEM.customers.n ame";
SqlDataAdapter adapter = new SqlDataAdapter( dataCommand);
DataSet ds = new DataSet();
adapter.Fill(ds );
dgCustInfo.Data Source = ds;
dgCustInfo.Data Bind();
conn.Close();
}
"chanmm" wrote:
The correct event should be PageIndexChangi ng in Gridview but
PageIndexChange d in DataGrid:
http://msdn2.microsoft.com/en-us/lib...xchanging.aspx
http://msdn2.microsoft.com/en-us/lib...ed(d=ide).aspx
chanmm
"Antonio" <An*****@discus sions.microsoft .com> wrote in message
news:72******** *************** ***********@mic rosoft.com...I am having a problem finding out how to page a datagrid.
I have the procedure for moving from page to page as:
private void changePage(obje ct source,
System.Web.UI.W ebControls.Data GridPageChanged EventArgs e)
{
dgCustInfo.Curr entPageIndex = e.NewPageIndex;
--connection information and SELECT statement here not in a separate
procedure--
I have an Edit button in the datagrid to edit the record, but when I click
on it I get an error saying that the pageindex must be >0 <pagecount.
In the editRecord procedure I have the connection information and SELECT
statement to display only the record being edited in the datagrid and
textboxes outside the datagrid that display the data to be edited.
Can someone help me out?
Thanks,
Antonio