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. Image for the cookie policy date
close icon

How to allow copying of cell data in ASP.NET MVC

I have the following Grid written in ASP.NET MVC and can not for the life of me figure out how to enable the copying of cell data in the current configuration. Any help would be greatly appreciated.
[code]
@(Html.EJ().Grid<OrderResponse>("MP_WebOrders")
          .Datasource(ds => ds.URL("/Order/GetMPOrders").Adaptor("UrlAdaptor"))
          .EnableAltRow()
          .AllowSorting()
          .ScrollSettings(scroll => scroll.Height("auto").Width("auto"))
          .AllowMultiSorting()
          .AllowFiltering(true)
          .IsResponsive()
          .SelectionType(SelectionType.Single)
          .SelectionSettings(select =>
          {
              select.CellSelectionMode(CellSelectionMode.Box).SelectionMode(new List<SelectionMode>() { SelectionMode.Cell });
          })
          .AllowSelection()
          .EditSettings(edit => { edit.AllowAdding().AllowDeleting(); })
          .SortSettings(sort =>
          {
              sort.SortedColumns(col => col.Field("OrderDate").Direction(SortOrder.Descending).Add());
              sort.SortedColumns(col => col.Field("InternalOrderID").Direction(SortOrder.Descending).Add());
          })
          .Columns(col =>
          {
              col.Field(c => c.IntegrationOrderId).IsPrimaryKey(true);
              col.Field(c => c.ExternalSystemName).HeaderText("External System").TextAlign(TextAlign.Left).Width(125).Add();
              col.Field(c => c.InternalOrderID).HeaderText("System Order ID").TextAlign(TextAlign.Left).Width(125).Add();
              col.Field(c => c.ERPOrderNumber).HeaderText("MAS Order Number").TextAlign(TextAlign.Left).Width(125).Add();
              col.Field(c => c.OrderStatus).HeaderText("Order Status").TextAlign(TextAlign.Left).Width(125).Add();
              col.Field(c => c.OrderTrackingNumber).HeaderText("Tracking Number").TextAlign(TextAlign.Left).Width(125).Add();
              col.Field(c => c.OrderDate).HeaderText("Order Date").Format("{0:MM/dd/yyyy}").TextAlign(TextAlign.Left).Width(125).Add();
              col.Field(c => c.OrderTotalPrice).Format("{0:C}").HeaderText("Order Total").TextAlign(TextAlign.Right).Width(125).Add();
              col.Field(c => c.LastUpdated).Format("{0:MM/dd/yyyy}").HeaderText("Last Updated").TextAlign(TextAlign.Left).Width(125).Add();
          })
          .ClientSideEvents(eve => eve.QueryCellInfo("checkIssueStatus")
          )
        )
[/code]

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team August 10, 2017 01:54 AM UTC

Hi Colin, 

Thanks for contacting Syncfusion support. 

By default, user-select property will be set to none in the ejGrid. If you would like to disable this, you must override this property in the Grid. This can be achieved by using the CssClass property of the Grid. 

Find the code example and sample:  


@(Html.EJ().Grid<object>("FlatGrid") 
    .Datasource((IEnumerable<object>)ViewBag.datasource) 
 
    -----------------         
    .CssClass("copyText") 
    .Columns(col => 
     { 
        ---------------------- 
    }) 
  ) 
 
----------------------------- 
<style> 
    .e-grid.copyText .e-rowcell { 
        -moz-user-select: inherit; 
        -khtml-user-select: inherit; 
        -webkit-user-select: text; 
        -ms-user-select: inherit; 
        user-select: inherit; 
    } 
</style> 



Regards, 
Prasanna Kumar N.S.V 
 


Loader.
Live Chat Icon For mobile
Up arrow icon