This is a migrated thread and some comments may be shown as answers.

[Solved] Drag from Grid Row and drop onto a LinkButton

1 Answer 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 09 Aug 2013, 10:37 AM
Hi 

I'm struggling with the last part of my drag drop functionality. I want to drag from a grid row (no problem there) and drop onto a LinkButton or preferably any html element within a RadListView. 

My page has a RadListView which has a number of dynamically created Tables, Table Rows, Table Cells and LinkButtons. When dropping the grid row on the LinkButton I can see the dragged element and also the e.HTMLElement is populated with the name of the LinkButton e.g. ctl00_MainContent_lvEngineers_ctrl0_lbtnTeamLeaderMeeting however I cannot seem to use FindControl to get the LinkButton, whatever I try returns nothing.

This page is within a Master page. I've tried rebinding the ListView, tried using FindControl on the RowDrop, Page_PreRender but no joy.

Many Thanks

Steve

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 14 Aug 2013, 07:50 AM
Hi Steve,

Before trying to use the FindControl() method, you will need to parse the string from the e.HTMLElement property to the ID of the control. Here as an example for splitting the ClientID, where the last element of the array will be the control's ID:
string[] split = "ctl00_MainContent_lvEngineers_ctrl0_lbtnTeamLeaderMeeting".Split('_');
Then the FindControl() method could be used with the last element of the array (the dropped target control ID): "split[split.Length - 1]".

Nevertheless, the approach for getting the LinkButton control with FindControl() depends on your scenario (master/content pages, nesting, etc.) and general solution could not be provided. 

 

Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or