how set the pagecount propety of gridview in Custom paging [Resolved]

Posted by Jaypalsinh under Regular Expressions on 7/6/2011 | Points: 10 | Views : 8165 | Status : [Member] | Replies : 2
Hi,
I am doing custom paging in GridView,
In that grid i don't want to bind all the records of the table.
In that manner my pagger template not displayed because of the PageCount property of the Grid.
How can I set the Page Count Property of the grid??
plz help me




Responses

Posted by: Lakn2 on: 7/7/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
protected void Page_Load(object sender, EventArgs e) 

{
if (!IsPostBack)
{
bindgrid();
ViewState["currentPage"] = 1;
}
}

public void bindgrid()
{
SqlDataAdapter da = new SqlDataAdapter("select * from emp1", cn);
DataTable dt = new DataTable();
da.Fill(dt);
GridView2.DataSource = dt;
GridView2.DataBind();
Session["dtEmp"] = dt;
}

protected void btnNxt_Click(object sender, EventArgs ev)
{
DataTable dtEmp = (DataTable)Session["dtEmp"];

DataView dvEmp = new DataView(dtEmp);
int currentPage = Convert.ToInt32(ViewState["currentPage"]) + 99;
dvEmp.RowFilter = "empNo > " + currentPage;
GridView2.DataSource = dvEmp;
GridView2.DataBind();
ViewState["currentPage"] = currentPage + 1;

}


Thanks&Regards
LakshmiNarayana Nalluri.

Jaypalsinh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 7/6/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,
try this...

<asp:GridView ID="PagedGridView"  AllowPaging=true  PageSize=25   EnableViewState=false    runat="server">

</asp:GridView>


Regards
Akiii


Jaypalsinh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response