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

Radgrid - Drag-n-drop - e.HtmlElement

5 Answers 246 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JH
Top achievements
Rank 1
JH asked on 05 Oct 2010, 09:44 PM
Hi,

I am using the grid's built in drag and drop functionality and have observed a strange issue.
When dropping a grid item onto a html control within the grid, the "e.HtmlElement" is empty. It is only not empty when dropping on items outside of the grid. Is there any way around this? I would really like to be able to drop a grid item onto a specific row to trigger some functionality.

Thank you

5 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 06 Oct 2010, 03:20 PM
Hello JH,

When you drop over a RadGrid item, e.HtmlElement (server argument) is null by design and you can use e.DestDataItem to find out the drop destination.

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx

On the other hand, the destination HTML element is available as an argument in the client-side OnRowDropping event...

http://www.telerik.com/help/aspnet-ajax/onrowdropping.html

and in the OnRowDropped event, only if you drop outside RadGrid.

http://www.telerik.com/help/aspnet-ajax/onrowdropped.html

Kind regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
JH
Top achievements
Rank 1
answered on 06 Oct 2010, 04:25 PM
Thank you for the answer.
The e.DestDataItem gives me the drop destination in terms of grid data items.. but I would like to find on what column/html element within the grid a row is dropped. I guess my only option is to use the client side event and postback the html element myself?
0
Dimo
Telerik team
answered on 07 Oct 2010, 07:37 AM
Hello JH,

Well, if you need the exact HTML element (e.g. table cell), you can post it manually indeed.

Best wishes,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
mostafa
Top achievements
Rank 1
answered on 22 Dec 2010, 05:41 PM
I have the same issue so I tried to do that from client side as you suggested but again eventArgs.get_destinationHtmlElement() returns null if I dropped the row on the gridView item template,any Suggestions?

<script type="text/javascript">
       function RowDropped(sender, eventArgs) {
           alert("Dropped target element id is: " + eventArgs.get_destinationHtmlElement().id);
       }
   </script>


<telerik:RadGrid ID="rGridCustomerListCount" runat="server" AutoGenerateColumns="False"
              GridLines="None" 
              OnRowDrop="rGridCustomerListCount_RowDrop">
              <MasterTableView DataKeyNames="AccID">
                  <RowIndicatorColumn>
                      <HeaderStyle Width="20px" />
                  </RowIndicatorColumn>
                  <ExpandCollapseColumn>
                      <HeaderStyle Width="20px" />
                  </ExpandCollapseColumn>
                  <Columns>
                      <telerik:GridBoundColumn DataField="AccNameEn" HeaderStyle-Width="180px" HeaderText="Account Name"
                          ItemStyle-Width="180px" UniqueName="column">
                      </telerik:GridBoundColumn>
                      <telerik:GridTemplateColumn HeaderStyle-Width="25px" HeaderText="U" ItemStyle-Width="25px">
                          <ItemTemplate>
                              <asp:Label runat="server" ID="U" Text='<%# Eval("U") %>'></asp:Label>
                          </ItemTemplate>
                      </telerik:GridTemplateColumn>
      </Columns>
      </MasterTableView>
              <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" AllowDragToGroup="True"
                  AllowKeyboardNavigation="True" AllowRowHide="True" AllowRowsDragDrop="True" EnableRowHoverStyle="True"
                  ReorderColumnsOnClient="True">
                  <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                  <Resizing AllowRowResize="True" EnableRealTimeResize="True" />
                  <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
              </ClientSettings>
          </telerik:RadGrid>


0
Iana Tsolova
Telerik team
answered on 27 Dec 2010, 02:35 PM
Hello JH,

Try nesting a div with particular ID in the ItemTemplate and see if this works for you.

All the best,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
JH
Top achievements
Rank 1
Answers by
Dimo
Telerik team
JH
Top achievements
Rank 1
mostafa
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or