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

How to find RadGrid Dynamic Cell Value in Client Side OnDoubleClick Event

3 Answers 174 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Myo
Top achievements
Rank 1
Myo asked on 24 Apr 2014, 03:59 AM

 Hi,
Anybody can help me how can I get selected cell value in radgrid dynamically. I would like to publish my code and attachement. What I want is when CellDbClick event fire, I want to get current selected cell value in attachement gridview. I appreciate any help.

.aspx
(
 <telerik:RadGrid runat="server" ID="grdAvailability" AllowPaging="true" AutoGenerateColumns="false"
                                         OnItemDataBound="grdAvailability_DataBound"
                                         PageSize="50" Height="565px" Skin="Simple">
                            <PagerStyle Visible="false"  />
                            <MasterTableView DataKeyNames="RoomKey" ItemStyle-Wrap="false" ClientDataKeyNames="RoomKey" TableLayout="Auto">
                            </MasterTableView>
                            <ClientSettings AllowRowsDragDrop="true">
                                <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" />
                                <ClientEvents OnCellSelected="cellSelected" OnScroll="HandleScrolling" OnRowContextMenu="OnRowContextMenu" />
                                <ClientEvents OnRowDblClick="CellDbClick" />
                                <Selecting CellSelectionMode="SingleCell" EnableDragToSelectRows="true" />
                            </ClientSettings>
                        </telerik:RadGrid>
)

Script
(
 function CellDbClick(sender, eventArgs) {
                var grid = sender;
                var MasterTable = grid.get_masterTableView();
                var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
                var cell = MasterTable.getCellByColumnUniqueName(row, 'RoomKey');
                var value = cell.innerHTML;
                var rvalue = cell.innerText;
                alert("HTML" + value);
                alert("Text" + rvalue);
            }
)

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Apr 2014, 09:26 AM
Hi,

Please try the following code snippet to get the selected cell value on row double-click.

JS:
<script type="text/javascript">
    function CellDbClick(sender, eventArgs) {      
        var cellvalue = eventArgs.get_domEvent().target.innerHTML;
        alert(cellvalue);
    }
</script>

Thanks,
Princy
0
Myo
Top achievements
Rank 1
answered on 25 Apr 2014, 01:00 AM
Hi Princy,

Now my function working perfect. By the way can you help me how to drag and drop one cell to another cell inside radgrid above attachment. I appreciate any help.

Thanks
0
Princy
Top achievements
Rank 2
answered on 25 Apr 2014, 03:56 AM
Hi,

You check this documentation on Drag and Drop of Grid Items to help you with your requirement.
Have a look into this online demo on Grid - Items Drag-and-drop to understand its functionality.

Thanks,
Princy
Tags
Grid
Asked by
Myo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Myo
Top achievements
Rank 1
Share this question
or