Add templatefield programatically

Posted on 2009-04-29
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


    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now