problem with datagrid with paging enabled

  • Thread starter Thread starter Mohan
  • Start date Start date
M

Mohan

Hi all,
I have a datagrid with paging enabled so that it displays only 8
records at a time. I have a template column with a textbox. The textbox
accepts numeric values. The problem is when i click on the next or
previous link on the datagrid, the values entered in the textbox is
lost. Is there way to retain the values.
I am not sure how to go about this. Appreciate any help in this matter.

Thanks
MB
 
Hi Mohan,

I suppose you are using code like following in PageIndexChanged event to
conduct pagination.
datagrid.CurrentPageIndex = e.NewPageIndex ;
datagrid.DataSource = datasourceObject;
datagrid.DataBind();

Apparently, once you move to any other page then back, the datagrid is
refilled with data from datasource. In order to keep values entered, one way
is to update datasource (either directly to database or to data object in
Session/Context desponding on how you manipulate data source) before
conducting pagination.

The disadvantage is that it causes bad performance.

BTW, it’s better to ask this kind question in aspnet or datagridcontrol group.

HTH

Elton Wang
(e-mail address removed)
 
Back
Top