Click here to Skip to main content
Click here to Skip to main content
Go to top

To make any column readonly in Datagrid

, 28 Jul 2006
Rate this:
Please Sign up or sign in to vote.
This is what i used to make a datagrid column readonly.
<!-- Article Starts - DO NOT ADD HTML/BODY START TAGS-->

Introduction

This is one of the way to make a column at any index readonly.

When datagrid is bounded to the datasource, the column and rows are genrated in the datagrid. This means datagrid must have the properties of the datasource. if the column in datasource is readonly then it must be apprear as readonly. Same thing I used to make the datagrid column readonly.

   this is just a piece of code..

   DT.Columns(0).ReadOnly = True '// Make the column(0) readonly and assign to DataGrid.

   Datagrid!.DataSource = DT

  where DT is datatable used to collect the data from database and is datasource to the datagrid Datagrid1.

  For further editing make the column readonly= false and make changes and again turn it into readonly.

 One can changed the index (0) of datatable to any index making that column / more than one column / all coulmn readonly.

if this way works , this will save your tedious job.

 Thanks.

 

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

prasonu123

India India
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 29 Jul 2006
Article Copyright 2006 by prasonu123
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid