views:

235

answers:

3

I have an ajax controltoolkit reorderlist within an asp.net application.

I need to disable certain specific steps from being reordered. This has to be done dynamically. All steps are consecutive and start from the beginning, but it's not known until runtime how many need to be disabled from being reordered any further.

I tried the e.item.enabled = false for reorderlist_itemdatabound but this just disabled links. I need to disable the drag handler.

Any help is greatly appreciated. Thanks!

A: 

To be honest, I'm not too familiar with this control, but...

You need to hide the drag handler div (or whatever is in the 'DragHandleTemplate' I believe) and/or change its class. Two suggestions:

1) Add a javascript startup script to disable the divs in question.

2) Subclass this control... Override the Render() method. Replace it with original code from ReorderList, but check the Item to see if you should render the drag handle.

Bryan
A: 

Hi, as a workaround to disable drag'n'drop for some item - you can set width=0 to the control inside

 <DragHandleTemplate> </DragHandleTemplate>
. Thus user won't be able to pick the item for dragging.

Woworks
A: 

Suppose you have an image with id "dragme" in DragHandleTemplate, do this in ItemDataBound handler:

Image dragMe = (Image)((TableRow)e.Item.Controls[0].Controls[0]).Cells[0].Controls[0].FindControl("dragMe");

dragMe.Style.Add(HtmlTextWriterStyle.Visibility, "hidden");

This way you preserve the alignment.

Dragos