Checkbox persistence during GridView paging

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Currently using VS2005 c#
Scenario: I have a gridview control displaying many items with paging enabled.
Column[1] is a checkbox column which users can check, but when the gridview
is paged to another page and then back again, the value of the checkbox has
been forgotten.
Is there a better way of persisting the values through the pages in VS2005
other than writing tedious code behind in the OnPageIndexChanging event?

Maybe using the Client Callback manager?

Any help would be great.
Thanks
 
Hi Paul,

Welcome to MSDN newsgroup!

For the current issue, adding some code in the OnPageIndexChanging event is
better way. As far as I know, the checkbox can't keep state after switching
because the data is rebind from the database, and the database is not
update. So if you want to implement the requirement, I suggest you should
add the updating data function in the OnPageIndexChanging. Then, after
switching (rebinding date), the state will be keep.
In my opinion, using the Client Callback is not a good way. There is a
large cost in database operation when we choose the checkbox and update the
data synchronously.
I hope the above information helps, if you have any questions or concerns,
please do not hesitate to let me know. I am looking forward your reply.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
Hi Yuan and thanks for the response,
I read somewhere that the new GridView control supports client-side paging
and sorting, all without needing to refresh the page. It does this by using
the Client callback manager(new in ASP.NET 2).
Is this not the case?

I would very much like to take advantage of this new feature to speed up the
whole process of flicking through grid pages.
It seems detrimental to me that re-binding the grid on each page would not
make use of the client side paging.
Would very much like to know your thoughts on this.

Many thanks
Paul
 
Hi Paul,

Thanks for your posting!

The GridView control supports client-script callback. But all the callback
function is created inside the ASP.Net core, and not exposes any interface
for other development. The below article describes the script call-back
technology in the ASP.Net version 2.0:
http://msdn.microsoft.com/msdnmag/issues/04/08/CuttingEdge/

From the article, all the callback function for each control is
encapsulated by .NET Framework itself. So for the current issue, if we want
to use script callback tech to update the data when calling the paging
function, it seems we should create our customer control like the GridView
and rewrite all script call-back functions which encapsulated before. Even
tough we would implement it, the all advantages of the ASP.Net v2.0 like
RAD, Drag-on-Drag, and data-binding was lost because the whole function
must be implement by ourselves. I think it's a bother thing. Actually, the
performance of using script call-back is worse than post back and the
stability also bad.

As far as I know, paging function under script call-back also need re-bind
the data from the server. The only difference is the appearance. So at the
current stage, I think use the post back is the wise choice.

I hope my description will be helpful, if you have something unclearly or
some concern, please let me know. I'm looking forward your reply.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
Hi Paul,

I want to know how things are going on? If you have any more information
related to this issue, please fell free to post here.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
Back
Top