Move Datagrid Row Up/Down

M

Michael Murphy

Hi,
Anyone have suggestions for how to select a row in a web datagrid and either
drag and drop it somewhere else in the grid or use up/down arrows to move
the row to the desired location?
Any feedback would be appreciated.
Thanks,
Michael Murphy
(e-mail address removed)
954-452-1047
 
E

Eliyahu Goldin

Similar question was discussed here recently. Google the usergroups for
thread "client side sorting of datagrid items".

Eliyahu
 
S

Steven Cheng[MSFT]

Hi Michael,

As Eliyahu mentioned, there're some former threads dicussing on such
questions. Generaly, since the asp.net datagrid is a serverside databound
template control which generate all the columns and rows via the datasource
bind to it, so the normal way to change the datagrid row's order is to
change the datasource bind to it. If you only want to change the datagrid's
display rows at clientside, we need to use some clientside scripts( such as
the DHTML behaviors ) mentioned in some other threads:

http://groups.google.com/groups?hl=en&lr=&threadm=umFJl#9rEHA.3848@TK2MS
FTNGP14.phx.gbl&rnum=1&prev=/groups%3Fq%3D%2522client%2Bside%2Bsorting%2Bof%
2Bdatagrid%2Bitems%2522%26hl%3Den

Also, here are some tech article links which demonstrate how to use
clientside DTHML behavior to alert the HTML TABLE element or asp.net
datagrid control at clientside via dhtml behaviors;

http://msdn.microsoft.com/msdnmag/issues/04/01/CuttingEdge/default.aspx

http://www.microsoft.com/mind/0499/HTMLbehaviors/HTMLbehaviors.asp

Hope helps. Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
M

Michael D Murphy

Steve,
Let's say I have the following grid characteristics:

Slot Name Other Info Details
1 Mike 38 Years LinkToDetailsRecord
2 Joe 41 Years LinkToDetailsRecord
3 Bob 23 Years LinkToDetailsRecord

Now Slot is not in the detail records, it is basicall a sort column used by
another process. What I want here, is for the administrator to be able to
move Bob to slot 2 where joe is and then joe would be slot 3. In other
words, select a row and be able to move it up one or down one,with the slot
numbers staying the same.
Hope this helps you understand what I need to do.
Michael
 
S

Steven Cheng[MSFT]

Hi Michael,

Thanks for your response and the further description. Based on your
requirement, I think it is very complex to implement such task via
clientside script(need very advanced javascript technique and time for
debugging). Also, when the page is post back,the clientside changes may not
reflect to the serverside datas. So my suggestion is when the datas
(records) first retrieved from database, we maintain it in a local
DataTable which stored in the page's viewstate or sessionstate. And when
the Administrator want to move rows up or down, just locate that certain
datarow in the stored datatable and adjust its position in the datatable
(switch with another row in the table) and rebind the table with the
datagrid again.
But this need the page to postback to serverside whenever the admin need to
do such changes on the grid.

Please let me know if you have any other concerns. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top