Search Results

Search found 1 results on 1 pages for 'user1545215'.

Page 1/1 | 1 

  • Insert and remove Template textbox column in grid view

    - by user1545215
    class TextColumn : ITemplate { private string controlId; private string cssClass; public TextColumn(string id, string cssClass = "inputFromTo") { controlId = id; this.cssClass = cssClass; } public void InstantiateIn(Control container) { TextBox txt = new TextBox(); txt.ID = controlId; txt.CssClass = cssClass; container.Visible = true; container.Controls.Add(txt); } } /******************* Add column code snippet ***************/ TemplateField dentry = new TemplateField(); TemplateField dexit = new TemplateField(); TemplateField dslack = new TemplateField(); dentry.ItemTemplate = new TextColumn("txtHH" + nameCount + "DEntry"); dexit.ItemTemplate = new TextColumn("txtHH" + nameCount + "DExit"); dslack.ItemTemplate = new TextColumn("txtHH" + nameCount + "DSlack"); gvOfcBlowingReport.Columns.Insert(startPoint, dentry); gvOfcBlowingReport.Columns.Insert(startPoint + 1, dexit); gvOfcBlowingReport.Columns.Insert(startPoint + 2, dslack); /***************** Remove column code snippet ************/ gvOfcBlowingReport.Columns.RemoveAt(startPoint - 1); gvOfcBlowingReport.Columns.RemoveAt(startPoint - 2); gvOfcBlowingReport.Columns.RemoveAt(startPoint - 3); // after executing this code all the columns vanish. Anyone know how to remove this text box template column?

    Read the article

1