Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

datagridview dgv is populated from a datatable dt.

One of the fields in dt i.e. field3 which is not null in the database table is hidden in the dgv. In the dgv itself, I can add a new row but the system wants me to add a value for the field3 because it is not null in the database table.

Question:
Is it possible to add a dummy value to this field3 even though it is hidden so that when it does not complain about having to add a new value to field3?

Thanks
Posted
Updated 23-Sep-11 0:52am
v2
Comments
Slacker007 23-Sep-11 6:53am    
Edited for some readability.
arkiboys 23-Sep-11 6:59am    
Hi, I can not see your reply.

1 solution

You could set a default value to the datatable before binding it.

Here is the MSDN info on default values:
http://msdn.microsoft.com/en-us/library/system.data.datacolumn.defaultvalue.aspx[^]
 
Share this answer
 
Comments
arkiboys 23-Sep-11 16:25pm    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900