"Tony WONG" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The gridview is created at runtime
>
> there is a column for checkbox (non-databind)
>
> i can create a blank column by the code
>
> Dim tfSelect As New TemplateField
> tfSelect.ItemStyle.Width = 80
> mygrid.Columns.Add(tfSelect)
>
> but i do not know how to add the checkbox in the column
Not quite sure if the syntax is correct as I never go anywhere near VB.NET,
but it's probably something like:
Dim MyCB As New CheckBox
' set any properties on MyCB as necessary
mygrid.Columns(0).Controls.Add(MyCB)
Obviously, you'll need to modify the column number in the third line
above...
Alternatively, you may be able to do this with the tfSelect object directly,
e.g.
Dim tfSelect As New TemplateField
tfSelect.ItemStyle.Width = 80
Dim MyCB As New CheckBox
tfSelect.Controls.Add(MyCB)
mygrid.Columns.Add(tfSelect)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net