We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupControl select single cell and copy the content

Thread ID:





117228 Sep 11,2014 01:42 AM UTC Sep 17,2014 09:23 AM UTC ASP.NET Web Forms (Classic) 2
Tags: GridGroupingControl
Asked On September 11, 2014 01:42 AM UTC

Is there any way to select a single cell or column?
And copy the selected cell content?

Silambarasan I [Syncfusion]
Replied On September 16, 2014 03:48 AM UTC

Hi Siang,


Thank you for using Syncfusion products.


We need to analyse on this and we will update you with further details on September 17, 2014.


Please let us know if you need any further assistance.



Silambarasan I

Silambarasan I [Syncfusion]
Replied On September 17, 2014 09:23 AM UTC

Hi Siang,


Thanks for your patience.


We are glad to let you know that your requirement (“To copy the selected content of the single cell or single columns cells in Ajax Grid”) can be achieved by using button click event or by using keydown (Ctrl+c) client-side event.  Please refer the below code snippets.







<Syncfusion:GridGroupingControl ID="GridGroupingControl1" runat="server" AjaxAutoformat="Office2007Blue"

EnableCallbacks="false" ShowGroupDropArea="false"  EnableAjaxMode="true"

DataSourceCachingMode="ViewState" AllowMultiSorting="false"  PageSize="15" PageIndexButtonCount="3" >




<asp:HiddenField ID="forSelectedContent" runat="server"></asp:HiddenField><br />

<div><b>Note:</b> Click "Copy !" button or press Ctrl+c to copy selected cells in Grid. </div>

<asp:Button ID="Button1" Font-Size="Large" runat="server" Text="Copy !" OnClick="Button1_Click" OnClientClick="CopySelectedContent()" />




public partial class Default : System.Web.UI.Page




private static string _Val;

public static string Val


get { return _Val; }

set { _Val = value; }



protected void Button1_Click(object sender, EventArgs e)


Val = this.forSelectedContent.Value;




protected void startCopy()


if (Val != "")


Thread staThread = new Thread(new ThreadStart(myMethod));

staThread.ApartmentState = ApartmentState.STA;


while (!staThread.IsAlive)






public static void copyMethod(string val)


Val = val.Replace("\n", "\r\n");

new Default().startCopy();



public static void myMethod()









var isCtrl = false;

var isC = false;


//Copy selected content to hidden variable

function CopySelectedContent() {

var gridObj = $find("GridGroupingControl1");


var selectedCellValue = $("." + gridObj.get_SelectionManager().currentCellBackground).text();


if (selectedCellValue != "")

document.getElementById('forSelectedContent').value = selectedCellValue;

else {

var selectedColumnValues = $("." + gridObj.get_SelectionManager().get_SelectedColumnCss());

document.getElementById('forSelectedContent').value = "";

var tempString = "";

$.each(selectedColumnValues, function (index, val) {

document.getElementById('forSelectedContent').value += val.textContent + "\n";





//Copy by keydown event (Ctrl+c)

$(document).keydown(function (event) {

var keycode = (event.keyCode ? event.keyCode : event.which);

if (keycode == 17 || keycode == 67) {

isCtrl = (keycode == 17) ? true : (isC = true);

if (isCtrl && isC) {



isCtrl = isC = false;




isCtrl = isC = false;



For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.


Sample: SampleProject.zip


Please let us know if you need any further assistance.




Silambarasan I


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon