Skip to content

How to prevent a datacolumn of gridview displaying null

amadobson

Asked Sep 18, 2003, 12:37 AM EDT1 answer
Share
LinkedInX
Hi I am in my 2nd week of c# .net and I have a datagrid which has a datasource set to a datatable I retrieved from a SQL database. I added a datacolumn to the datasource called "Selected" as a boolean which is the only column the user can change. ie. A tick box has appeared for each row and the user can select / de-select the row The only problem is the user can select the DBNull state. I have disabled this in the definition of the datacolumn but I don't want the user to even be able to set it to null (grayed tick) Can anyone point me in the right direction Cheers Alan :-)

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Alan, Set the ThreeState property of the checkbox to false. You might need to make some changes.. Set AutoGenerateColumns for the datagrid to false. define the datagrid columns. Create a TemplateColumn for the boolean column. Set the ThreeState Property of the checkbox defined in the Template to false. There may be other easier/shorter ways to do the same thing .. - dip
    0