I have a datagridview with a template field. How can i make that field as ReadOnly ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deepubalakrishn
    New Member
    • Mar 2011
    • 1

    I have a datagridview with a template field. How can i make that field as ReadOnly ?

    I have a datagridview with a template field. How can i make that field as ReadOnly when I load the grid in Web Forms.

    " dataGridView1.C olumns["CompanyNam e"].ReadOnly = true; " works only for Windows Forms DataGridView Control. So how can I do it in Web Forms.

    Thanks in advance
    Last edited by jhardman; Mar 15 '11, 06:58 PM. Reason: accidentally posted in ASP classic forum. moved to asp.net
  • Rob S
    New Member
    • Jan 2011
    • 14

    #2
    If your TemplateField cantains an EditTemplate inside it then your field will be editable. If you remove the EditTemplate the field is not editable anymore. So when a user clicks on the "Edit" button (assuming that there is an edit button) he will not be able to alter the contents of the field. HTH

    Comment

    Working...