Click here to Skip to main content
16,013,082 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey,

how does the code for gridview go?...

mine is-

C#
protected void grdOrder_PageIndexChanging(Object sender, GridViewPageEventArgs e)
    {
        grdOrder.PageIndex = e.NewPageIndex;
        grdOrder.DataBind();
    }


this is not working,i am adding values to a datatable on button click and then binding it to the grid.
Posted

not working this code
for PageIndexChanging event in grid view
 
Share this answer
 
I am doing this now and its working:--

protected void grdOrder_PageIndexChanging(Object sender, GridViewPageEventArgs e)
    {
        DataRow drValues = dtValues.NewRow();
        dtValues.Rows.Add(drValues);
        dtValues.AcceptChanges();
        grdOrder.DataSource = dtValues;
        grdOrder.DataBind();
        grdOrder.Visible = true;
        grdOrder.PageIndex = e.NewPageIndex;
        grdOrder.DataBind();
    }


But,Every time i open next page while adding items,a row is left blank and then new records are added.No row is left blank in the page if i don't open the page before all rows are filled.
 
Share this answer
 
v2
Comments
AmitChoudhary10 24-Sep-10 7:42am    
Its done.Thanks newayz..
AmitChoudhary10 24-Sep-10 7:43am    
DataRow drValues = dtValues.NewRow();
dtValues.Rows.Add(drValues);

these rows were not required!!
Sandeep Mewara 24-Sep-10 7:58am    
Not an answer.
Sandeep Mewara 24-Sep-10 7:58am    
Use 'Improve Question' button to edit/update your question any number of times.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900