Click here to Skip to main content
13,087,797 members (76,223 online)
Click here to Skip to main content
Add your own
alternative version


21 bookmarked
Posted 28 Jul 2006

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-->


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.





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


About the Author

India India
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170813.1 | Last Updated 29 Jul 2006
Article Copyright 2006 by prasonu123
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid