I have an asp.net page with several list boxes.
I would like to include some javascript on the page that allows a user to drag individual list elements from one box to another.
On a normal web page, the script to do this is reasonably simple, however, with the element IDs generated by ASP.NET, I don’t know what identifiers to have my script look up?
Any thoughts on how to do something like this?
Check out the
ClientIdproperty of theControlclass.Note: The ASP.NET
ListBoxcontrol inherits fromControl.Update
In reponse to the comments below, I can think of two ways to access the individual
lielements of an unordered / ordered list generated by theListBoxcontrol.Controlthat inherits fromthe
ListBoxcontrol and renders out anid attribute for each
lielement.getElementsByTagNamemethodin JavaScript. MSDN even has an
example that uses the
getElementsByTagNamemethod to getthe children of an unordered list and
displays an alert indicating the
number of children and the value of
the first child element. If the MSDN documentation isn’t your thing, you can check out the MDC documentation as well.