How can I let the user change the order of items in a repeater?

A

Alan Silver

Hello,

I have a repeater showing a list of items and I would like to be able to
allow the user to change the order of the items. I have absolutely no
idea how to go about this, other than having a pair of Move Up/Down
buttons, which would result in a postback for every single move. This
would be very slow and frustrating for a user trying to move an item to
the top of a list.

Any ideas welcome. TIA
 
G

Guest

It's possible to move them on the client using JavaScript.

My question is, what is rendered out to the client? If it is just random
html, it might be pretty difficult.

A 3rd party control would have a more sophisticated JavaScript Object
Notation model for capturing, moving, editing specific client side items.
--
Direct Email: Michael.Baltic@RemoveCharactersUpTo#NCMC.Com

Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group
 
A

Alan Silver

It's possible to move them on the client using JavaScript.

Any suggestions how? Javascript isn't my strong point ;-(
My question is, what is rendered out to the client? If it is just random
html, it might be pretty difficult.

Not sure what you mean here. The data in the repeater is just text, not
HTML.
A 3rd party control would have a more sophisticated JavaScript Object
Notation model for capturing, moving, editing specific client side items.

Do you know of one?

Thanks for the reply.
 
G

Guest

If you aren't fond of doing postbacks, you will need to become a superstar at
JavaScript. Once you learn how to use it, your whole design process will
change!

Anyways, can you send me a sample of what kind of html is generated by your
control?

Basically, you will need to assign an id to each element that you want to
move. Then, you will need JavaScript event handlers for the mouse down event
and mouse up event so that you can capture which control was clicked on and
where it was dragged to. Then, you will have to rewrite the html in the new
order.

Huge task huh? Look at the ComponentOne and Infragistics tools or R.A.D.
they all have very advanced client side code.

If cost is an issue, find a control in the above companies toolset that you
like and search google for a cheap/free version?
--
Direct Email: Michael.Baltic@RemoveCharactersUpTo#NCMC.Com

Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group
 
A

Alan Silver

If you aren't fond of doing postbacks, you will need to become a superstar at
JavaScript. Once you learn how to use it, your whole design process will
change!

It's not my fondness (or lack) of postbacks that is the issue, this is
part of a much bigger form, and the user might not want to post the form
yet. They might not even be able to as other controls may fire
validation warnings, preventing them from posting until they fix the
data issues.
Anyways, can you send me a sample of what kind of html is generated by your
control?

Plain old HTML table containing a list of product variations and sizes,
for example...

Small 1.99
Medium 2.99
Large 3.99

I just want them to be able to set the order. In many cases, if ordered
alphabetically, you would have an illogical ordering.
Basically, you will need to assign an id to each element that you want to
move. Then, you will need JavaScript event handlers for the mouse down event
and mouse up event so that you can capture which control was clicked on and
where it was dragged to. Then, you will have to rewrite the html in the new
order.
Ulp.

Huge task huh? Look at the ComponentOne and Infragistics tools or R.A.D.
they all have very advanced client side code.

I have the C1 components, but haven't really investigated any of them
yet. Do they have anything similar to this, or were you just pointing
out that complex JS is a fact of life if you want a decent interface?
If cost is an issue, find a control in the above companies toolset that you
like and search google for a cheap/free version?

I had a thought that I could offer a link where they can open a
secondary window containing a listbox of the current variations and
allow them to order that. I think that would be easier than the way you
suggested. They would have to post back at the end, but it would be part
way there. I was going to look around for some js examples of this sort
of thing.

Thanks for the comments.
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top