Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to copy only One column data when user click on data and press ctrl+c.But i am using devexpress grid view.Following code am added.
CSS
Am added like gridViewBatches.Columns["Batch No"].ReadOnly = true; Error    71  Property or indexer 'DevExpress.XtraGrid.Columns.GridColumn.ReadOnly' cannot be assigned to -- it is read only 
Posted

Hi,
To learn how to make your GridControl readonly, please see the How to make my grid columns read-only Knowledge Base article.
 
Share this answer
 
Comments
Member 11984408 22-Sep-15 4:37am    
This is not working..
Bhagawat Shinde 22-Sep-15 6:48am    
Can you post your code after implementing above link.
You can use showingEditor event to achieve this task,

private void gridView1_ShowingEditor(object sender, System.ComponentModel.CancelEventArgs e) {

GridView view = sender as GridView;

if(view.FocusedColumn.FieldName == "Region" && !USCanada(view, view.FocusedRowHandle))

e.Cancel = true;

}
Member 11984408 22-Sep-15 6:58am    
private void gridViewBatches_ShowingEditor(object sender, CancelEventArgs e)
{

GridView view = sender as GridView;

if (view.FocusedColumn.FieldName == "Batch No" )//&& !USCanada(view, view.FocusedRowHandle))

e.Cancel = true;
}
This is code but what is necessary conditions for this implementation.
Member 11984408 22-Sep-15 7:00am    
I Want to copy data from column Batch No only.
C#
private void gridViewBatches_ShowingEditor(object sender, System.ComponentModel.CancelEventArgs e)
{
    GridView view = sender as GridView;

    if (view.FocusedColumn.FieldName == "Batch No") //Editable true
    {
        e.Cancel = false;
    } else //Other column editble false
    {
        e.Cancel = true;
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900