Duplicate TemplateField in a custom control deriving from GridView

Discussion in 'ASP .Net Web Controls' started by Sunny, Jul 14, 2006.

  1. Sunny

    Sunny Guest


    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,

    Sunny, Jul 14, 2006
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page