On Jul 23, 7:30 pm, "Patrice" <http://www.chez.com/scribe/wrote:
Let's restart fresh. This is not the expected behavior and we can't really
guess what you have done wrong without seeing some code.
I would suggest to simplify your code as much as possible even possibly
providing a fictionous code constructed datatable as a data source and show
us the code around 20 lignes of code should be enough to reproduce this
problem.
My guess was that the data are binded on each postback to the grid causing
the paging mechanism to be reset. But it seems this is not what you were
doing (my suggestion was about what the problem is, not how it should be
fixed, sorry for being unclear)...
How do you bind those data ? Do you do this only on the first run or on each
postback ?
--
Patrice
"Christian Cambier" <christian.camb...@gmail.coma écrit dans le message de
groupe de discussion :
adf8b794-b90f-4813-90dd-a69d95ce0...@l64g2000hse.googlegroups.com...
On Jul 23, 5:42 pm, "Patrice" <http://www.chez.com/scribe/wrote:
Do you rebind your date to the grid on each postback ?
<cmr...@gmail.coma écrit dans le message de groupe de discussion :
0021d58e-0cc4-4e11-93e5-246a9cf4a...@x41g2000hsb.googlegroups.com...
Hello,
I have set the Allowpaging property to true in a standard DataGrid-
control (System.Web.UI.WebControls).
when run in the browser i get the first records in the first page,
there are 5 pagesi n total, but when I click on the next page number,
I always get the records of the first page ?
how come?
thank you
Chris
hello,
Is that what you mean?
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataGrid1.DataBind();
}
}
but i still get the problem.
what do you suggest?
thank you
Chris
thank you for your time!
here's what i\ve done.
In design mode: I drag a datagrid control on the webform. I configure
the datasource using the wizard that appears so I specify:
the data connection , the sql-select statement and that's it.
the code generated in my webform1.aspx is:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="CSharpWebApp.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:DataGrid ID="DataGrid1" runat="server" AllowPaging="True"
DataSourceID="SqlDataSource1">
</asp:DataGrid>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT * FROM [Products]"></asp:SqlDataSource>
</form>
</body>
</html>
and added in the code behind-file:
protected void Page_Load(object sender, EventArgs e)
{
//if (! IsPostBack)
DataGrid1.DataBind();
}
it doesn't work, with or without the commented line
only the first records are shown.
any ideas?
Chris