Results 1 to 2 of 2

Thread: new column in datagrid

  1. #1
    MartinWilson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    281
    Rep Power
    3

    Default new column in datagrid

    I am working on one live project where I use Asp.net as front end and SQL as back end. I want to add new column in datagrid at runtime? Is this possible or not? Any help would be appreciated. Thanks in advanced.

  2. #2
    JacksonPerez is offline Banned
    Join Date
    Dec 2009
    Posts
    274
    Rep Power
    0

    Default

    Use the following language rules to add Column at runtime

    DataGridView1.line.Add ( string ColumnName, string ColumnHead)

    If your Combobox values are unique then use ComboBox selected value as Column name and Caption if not select your own column name and ColumnHead can be combobox value. Because Column name are unique.

    Use SelectedIndexChanged event of Combobox to add new Column and
    after adding new Column take away it from the Combobox

    Code:
    DataGridView1.Columns.Add( "MyColumn", "Column 1" );

Similar Threads

  1. Update datagrid
    By BarnesHarris in forum Programming
    Replies: 2
    Last Post: 07-10-2010, 01:14 PM
  2. DataGrid with Fixed legend & scroll in ASP.NET
    By MyersGray in forum Programming
    Replies: 2
    Last Post: 02-10-2010, 05:44 PM
  3. Include column to GridView Programmatically
    By CruzPowell in forum Programming
    Replies: 1
    Last Post: 02-10-2010, 04:30 PM
  4. VIBlend DataGrid for Silverlight
    By SmithJohnson in forum Operating System
    Replies: 1
    Last Post: 01-29-2010, 05:51 PM
  5. Add a smart column
    By fimanson in forum Everything Else
    Replies: 0
    Last Post: 06-23-2008, 03:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48