how to create paging in a dynamic gridview
Posted
by
bharathi
on Stack Overflow
See other posts from Stack Overflow
or by bharathi
Published on 2012-11-23T10:02:33Z
Indexed on
2012/11/26
17:04 UTC
Read the original article
Hit count: 228
c#
I am using C# ,here i attach my partial code for dynamic grid view its working fine . I need to set paging on the dynamic grid view how can i call the OnPageIndexChanging
GridView gv = new GridView();
gv.AllowPaging = false;
gv.AlternatingRowStyle.BackColor = System.Drawing.Color.WhiteSmoke;
gv.GridLines = GridLines.Horizontal;
gv.CellPadding = 2;
gv.CellSpacing = 5;
gv.HeaderStyle.BackColor=System.Drawing.Color.Black;
gv.HeaderStyle.ForeColor = System.Drawing.Color.White;
gv.AutoGenerateColumns = false;
BoundField nameColumn = new BoundField();
nameColumn.DataField = "fld_id";
nameColumn.HeaderText = "First Name";
gv.Columns.Add(nameColumn);
nameColumn = new BoundField();
nameColumn.DataField = "fld_name";
nameColumn.HeaderText = "Last Name";
gv.Columns.Add(nameColumn);
nameColumn = new BoundField();
nameColumn.DataField = "fld_state";
nameColumn.HeaderText = "Age";
gv.Columns.Add(nameColumn);
gv.DataSource = ds;
gv.DataBind();
plangrid.Controls.Add(gv);
© Stack Overflow or respective owner