1
Answer

adding check box column to dataTable. ref Trusha Ameta

M

M

19y
5.3k
1
Hi I am new to this forum and c# so please forgive any ignorance. I am currently working with c# web parts for sharepoint portal products and bla bla.....zzzz.

I have created a table containing colums the first of which is dataColum which should contain check boxs which eventually be used to fire a row data to another web part a la several articals floating around the net.

//'Add a Column with checkbox at last in the Grid     
// '     DataColumn dtcCheck    = new DataColumn("select");//create thedata         
//'column object with the name 
//  '    dtcCheck.DataType      = System.Type.GetType("System.Boolean");//Set its //data Type
// '   
dtcCheck.DefaultValue  = false;//Set the default value
//'     dataTable.Columns.Add(dtcCheck);//Add the above column to the //Data Table

This was taken from an artical from c#corner and is confirmed by other such articles.

Two other colums are then created and with rows containg data all of which are then bound to a dataGrid with some styling.

When i run this everything looks fine except for the check box column which displays the string value of the colum.

|select|title     |details      
|false  |name   |tony         
|false  |number |646465
|false  |status  | C

The obvious one to me is that there no declaratin for the new checkBox. However in Trusha Ametas' article does not mention the declaration of one either.

any ideas please feel free to jump in!!

thanks for your time.
Answers (1)