Paging in GridView without Binding Data |
|
Answered By
Moderator1
on
2/6/2010 12:50:36 AM |
|
|
|
|
Hi,
Without binding data you cannot make paging in GridView control. For every event you need to bind the Gridview control. As you are not taking data from database, you can save your datatable or dataset in the ViewState variable.
I mean, when you enter value in your textbox and submit, add it as a row in a DataTable, then this DataTable has to be saved as ViewState variable, then bind this DataTable with the GridView control, this will enable paging in GridView control. |
|
|
|
About Binding and viewstate |
|
Answered By
Muhammad Fahad
on
2/6/2010 6:34:43 AM |
|
|
|
|
when i post data form textboxes to girdview after that i am binding data to gridview.
but i dont know how to save in view state plz tell me about that...
Thanx in advanced. |
|
|
|
Assign DataTable to ViewState variable |
|
Answered By
Moderator1
on
2/9/2010 12:51:04 AM |
|
|
|
|
Hi,
So you know how to bind data to a DataTable before bind it to GridView control. So the syntax to save DataTable to ViewState is below,
ViewState["dataTable"] = datatable;
For retrieving the value from ViewState,
DataTable datatable = (DataTable) ViewState["dataTable"]; |
|
|
|