GridView Cell Content Not Selectable

Posted by: tlbradshaw on 10 September 2017, 11:33 am EST

  • Posted 10 September 2017, 11:33 am EST

    <p>I am not able to highlight data from my GridView and use the Right-Click to copy the data to the clipboard.  I don't even get a "Copy" option when Right Clicking.</p>
    <p>This occurs both in IE 8 and Firefox 3.6.6.  I am using C1.Web.UI.3.dll Version 3.5.20101.72.</p>
    <p> I would like my users to be able to copy text from the cells to paste into the filter bar, but I cannot seem to get the cell content to select.  Is this a function of the CSS, or maybe the Z-index of the control?  </p>
    <p> </p>
    <p>I would settle for being able to double click a cell and have to GridView Filter by that value.</p>
    <p> </p>
  • Replied 10 September 2017, 11:33 am EST

    <p>you can set the SelectionMode property to "None", then you'll be able to select cell content and copy it via browser context menu.</p>
    <p>As an alternative you can implement copying of the current cell content by pressing a hotkey (Ctrl+Z in the sample below). In this case you do not need to turn off SelectionMode:</p>
    <p><script type="text/javascript"></p>
    <p>    function gv1_keydown(sender, e) {</p>
    <p>        if (e.ctrlKey && e.keyCode === 90) {</p>
    <p>            var currency;</p>
    <p>            var grid = $find("GridView1");</p>
    <p>            if (currency = grid.get_currency()) {</p>
    <p>                if (C1.Web.UI.Controls.C1GridView.C1BoundField.isInstanceOfType(currency.get_column())) {</p>
    <p>                    var cellIdx = currency.get_cellIndex();</p>
    <p>                    if (grid.get_rowHeader().get_visible()) {</p>
    <p>                        cellIdx++;</p>
    <p>                    }</p>
    <p>                    var filterCell = C1.Web.UI.Controls.C1GridView.C1GridViewRowsAccessor.getCell(grid.get_filterRow(), cellIdx);</p>
    <p>                    if (filterCell) {</p>
    <p>                        var $testElement = $(filterCell).find(".C1TextBox");</p>
    <p>                        if ($testElement.length) {</p>
    <p>                            var c1InputCtrl = $find($testElement.attr("id"));</p>
    <p>                            if (c1InputCtrl) {</p>
    <p>                                c1InputCtrl.set_text(currency.get_value());</p>
    <p>                            } else { // just a textbox ?</p>
    <p>                                $testElement.val(currency.get_value());</p>
    <p>                            }</p>
    <p>                        }</p>
    <p>                    }</p>
    <p>                }</p>
    <p>            }</p>
    <p>        }</p>
    <p>    }</p>
    <p><c1g:C1GridView runat="server" ID="GridView1" onkeydown="gv1_keydown(this, event)" ... ></p>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels