Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Duplicate TemplateField in a custom control deriving from GridView

Thread Tools

Duplicate TemplateField in a custom control deriving from GridView

Posts: n/a

I am having problem with a derived class from GridView in which I added
an empty image in the itemTemplate. Basically what I am trying to do is
adding an image column with an arrow instead of a select button. It
built fine, but when I modified any of the attributes in teh designer
mode, it kept adding another column of the same one. I think the
problem is because I added the column in teh class constructor but I
tried adding in OnLoad, OnInit and OnPreRender. Nothing works. Can
anyone point me out here? I am attaching my code herewith.

public class ItsGridView : System.Web.UI.WebControls.GridView

public ItsGridView()
TemplateField tf = new TemplateField();
tf.ItemTemplate = new
tf.HeaderText = string.Empty;
this.Columns.Insert(0, tf);

Thank you in advance,


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fetching control values from a gridview TemplateField ASP .Net 3 01-03-2008 04:00 PM
TemplateField in 2.0 // Disappears on Postback when TemplateField is added thru code sloan ASP .Net 2 10-17-2007 09:08 AM
Boundcolumn or TemplateField when to use Boundcolumn and when TemplateField ???? mesut ASP .Net 0 06-29-2007 10:17 AM
Duplicated TemplateField in the derived control from GridView in the Design mode ASP .Net 0 07-14-2006 02:43 PM
Gridview control and sorting a calculated templatefield column ? ASP .Net 2 06-14-2006 01:49 AM