Hi All,
Is there a way to avoid the DataGrid from adding new line in it.
I managed to do it by doing the following:
dg1.ReadOnly = True, but the problem in this the user will not be able to change any existing data in it.
Thanks for the help.
Printable View
Hi All,
Is there a way to avoid the DataGrid from adding new line in it.
I managed to do it by doing the following:
dg1.ReadOnly = True, but the problem in this the user will not be able to change any existing data in it.
Thanks for the help.
You have to bind your datagrid to a Dataview and set the data view Allownew to False. If you dotn want ppl to delete rows you can set AllowDelete to False and if not editable set AllowEdit to False.
You can define a new dataview or even you can use the dataset table default view to manage it.
Thank Lunatic3 for your reply,
Do you mean I have to use a DataView insted of the DataSets I am using?
If yes, will I be able to save the changed back to my table using DataView?
Note:
My DataSet has about 7 tables in it with a relation between them, what the case will be if I used the DataView ?
Thank in advance.
Yes, you may use a Dataview and bind your datagrid to that. Dataview is the top most view of your table. Any change you make to that will affect the underlying dataset table. It doesnt matter if you have relations in your dataset tables. The relations are some rules, so it doesnt matter how you manipulate the data in datatable, you just have to keep the rules.
Thnak you Lunatic3 ;)