Click here to Skip to main content
Licence 
First Posted 28 Jul 2006
Views 23,290
Bookmarked 19 times

To make any column readonly in Datagrid

By | 28 Jul 2006 | Article
This is what i used to make a datagrid column readonly.

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

About the Author

prasonu123



India India

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 29 Jul 2006
Article Copyright 2006 by prasonu123
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid