By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,430 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
"Alan Silver" wrote:
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

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #2

P: n/a
>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.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #3

P: n/a
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
"Alan Silver" wrote:
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.

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #4

P: n/a
>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.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.