Add templatefield programatically

Hi, am trying to create a gridview programatically, I have the following code to ceate the boundfields but also need to create a templatefield with an image button.

Is there any way this can be achieved?
Thanks
Dim Field As New BoundField
 
Field.DataField = "JobNo"
Field.HeaderText = "Job No"
Field.ItemStyle.Width = 65
Field.HeaderStyle.HorizontalAlign = HorizontalAlign.Left
GridView4.Columns.Add(Col)
 
Field = New BoundField
Field.DataField = "NameAddress"
Field.HeaderText = "Name & Address"
Field.ItemStyle.Width = 293
Field.HeaderStyle.HorizontalAlign = HorizontalAlign.Left
Col = Field
GridView4.Columns.Add(Col)
 
Me.dgvProgram.DataSource = tblProgramData
Me.dgvProgram.DataBind()
Me.dgvProgram.Width = 766

Open in new window

HiggsterAsked:
Who is Participating?
 
HiggsterAuthor Commented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.