Author: mkeener | Posted on: 7/14/2008 6:54:20 AM | Views : 568

 I am trying to create a gridview programatically.  I have no problems creating bound fiends and filling them with data, however i cannot seem to create a template field.  I want to create a template field with a textbox.  This is my code so far : 

 
'sets template field properties
Dim txtQty As New TextBox

'sets template fields
Dim Qty As New TemplateField
Qty.ItemTemplate = txtQty

gv.Columns.Add(Qty) This errors out saying "Unable to cast object of type 'System.Web.UI.WebControls.TextBox' to type 'System.Web.UI.ITemplate'." Any help would be much appreciated.
...

Go to the complete details ...