Add templatefield programatically

Posted on 2009-04-29
Medium Priority
Last Modified: 2012-05-06
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?
Dim Field As New BoundField
Field.DataField = "JobNo"
Field.HeaderText = "Job No"
Field.ItemStyle.Width = 65
Field.HeaderStyle.HorizontalAlign = HorizontalAlign.Left
Field = New BoundField
Field.DataField = "NameAddress"
Field.HeaderText = "Name & Address"
Field.ItemStyle.Width = 293
Field.HeaderStyle.HorizontalAlign = HorizontalAlign.Left
Col = Field
Me.dgvProgram.DataSource = tblProgramData
Me.dgvProgram.Width = 766

Open in new window

Question by:Higgster
LVL 20

Accepted Solution

informaniac earned 800 total points
ID: 24258579

Author Closing Comment

ID: 31575837

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question