How to set row values as Datagrid Column Header?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lucindaa
    New Member
    • Dec 2009
    • 11

    #1

    How to set row values as Datagrid Column Header?

    How to set row values as Datagrid Column Header?
    Please any help me
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    You probably might be filling the datagrid with a datasource ....

    So Manuallly loop through the Datagrid datasource...
    get the row values and like this dataSet1.Tables[0].Rows.Cells[0] something like that....

    and construct a new datatable and add the values of a the row as the DataColumn name of he dataTable.... it should be pretty simple

    Comment

    • lucindaa
      New Member
      • Dec 2009
      • 11

      #3
      Problem Solved

      Thanks for your help

      Comment

      • ThatThatGuy
        Recognized Expert Contributor
        • Jul 2009
        • 453

        #4
        Construct a DataTable like this....
        DataTable dt=new DataTable();

        then do dt.Columns.Add( 'Here add the value retrieved');

        do this for the no of times you like and assign this DataTable as a DataSource to the DataGrid.....

        like this.... DataGrid1.DataS ource=dt;

        Comment

        Working...