.Net ramblings
# Monday, 22 November 2004
How to disable new rows in Windows Forms DataGrid

i found a few work arounds to prevent a datagrid from displaying the * new row. one of them involved using a dataview as the datasource, with AllowNew property set to false. however, someone called Sameers from theAngrycodeR pointed out that a datatable has a DefaultView property which also has this AllowNew property. so you can use the following code (if your datasource is a dataset):

this.dataSet1.Tables[0].DefaultView.AllowNew = false;

and you get to keep the dataset or datatable as the direct datasource.


Monday, 22 November 2004 17:05:24 (GMT Standard Time, UTC+00:00)  #    Comments [0]  .Net Windows Forms

OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview