471,348 Members | 1,322 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

DataGrid Pagin Not Work

Hi there
my problem is with datagrid pagin.when i try to add the pagin feature to my
datagrid i get a strange behavior.
i will explain in details:
i wanted to allow pagin in the datagrid so i have put AllowPagin property =
and then i have implemented the PageIndexChanged event handler.and made all
required changes to re-filling the datasource.in this case the pagin worked
but when i have put the AutoGenerateColumns property = false the pagin
didn't work.i don't know why this happened.i hopw that you can help me
this is my current code:
private void Page_Load(object sender, System.EventArgs e)
// Put user code to initialize the page here
//Start of the MyDataGridBind() Function//
void MyDataGridBind()
SqlConnection sqlcon = new SqlConnection();
SqlCommand sqlcom = new SqlCommand();
SqlDataAdapter sqlDA = new SqlDataAdapter();
DataSet dsRates = new DataSet();

sqlcon.ConnectionString =
sqlcom.Connection = sqlcon;
sqlcom.CommandType = CommandType.Text;
sqlcom.CommandText = "SELECT * FROM rates";
sqlDA.SelectCommand = sqlcom;
DataGrid1.DataSource = dsRates;

BoundColumn bc2 = new BoundColumn();
BoundColumn bc3 = new BoundColumn();
ButtonColumn bc5 = new ButtonColumn();

bc2.DataField = "country";
bc2.HeaderText = "Fiyat";

bc3.DataField = "rate";
bc3.HeaderText = "Bilgi";

bc5.ButtonType = ButtonColumnType.LinkButton;
bc5.CommandName = "SendMail";
bc5.HeaderText = "Başvur";
bc5.Text = "Satın al";

//End of the MyDataGridBind() Function//

private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
DataGrid1.CurrentPageIndex = e.NewPageIndex;
Nov 26 '05 #1
0 860

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Frosty | last post: by
2 posts views Thread by pei_world | last post: by
2 posts views Thread by Scott | last post: by
2 posts views Thread by Marty McDonald | last post: by
7 posts views Thread by Scott Schluer | last post: by
4 posts views Thread by The Alchemist | last post: by
1 post views Thread by alexmaster_2004 | last post: by
7 posts views Thread by GaryDean | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.