?
Solved

column header

Posted on 2005-04-14
3
Medium Priority
?
265 Views
Last Modified: 2010-04-07
Hi,

How can we place the column headers for a datagrid to the left side?

i.e.
Normal datagrid:
ID  Name Age Sex Score


How can we place it to the leftside:
ID
Name
Age
Sex
Score

If datagrid is not possible of achieving this, which control can we use? data will be on SQL server. (asp.net using vb)

Thanks.


0
Comment
Question by:lynnton
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
sachiek earned 2000 total points
ID: 13779969
0
 
LVL 11

Expert Comment

by:sachiek
ID: 13779979
There is one more quiet complex example out there

http://aspalliance.com/538


Sachi
0
 
LVL 1

Author Comment

by:lynnton
ID: 13780147
sachiek,

is it okay if you help me convert my present data source to pivot format (I'm not familiar with the other command, don't know what value to place.)

table called employee
ID
Name
Age
Sex
Score



                       Private Function GenerateSource() As DataTable
                          Dim con As New SqlConnection("......")
                          Dim cmd As SqlCommand = con.CreateCommand()
                          cmd.CommandType = CommandType.StoredProcedure
                          cmd.CommandText = "SP_operator_id_name_desig_team"
                          cmd.Parameters.Add(New SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, False, CType(0, Byte), CType(0, Byte), "", DataRowVersion.Current, Nothing))
                          Dim da As New SqlDataAdapter(cmd)
                          Dim ds As New DataSet()
                          da.Fill(ds,"DataSetName")
                          Return ds.Tables("DataSetName")
                          cmd.dispose
                          cmd.parameters.clear
                          con.close
   
                       End function

                       Sub Page_Load(Sender As Object, E As EventArgs)
                          If Not Page.IsPostBack Then
                               datagrid1.DataSource=GenerateSource().DefaultView
                          end if
                        end sub


-------------------------please help me fill in the blanks

      Public Function PivotTable([source] As DataTable) As DataTable
         Dim dest As New DataTable("Pivoted" + [source].TableName)
         
         ' create shchema (string columns) for the destination
         '            the first column is for the source column name
         dest.Columns.Add(" ")
         
         '      the remaining dest columns are from each source table row (1st column)
         Dim r As DataRow
         For Each r In  [source].Rows
            dest.Columns.Add(r(0).ToString()) ' assign each row the Product name (r[0])
         Next r
         ' now add one row to the dest table for each column in the source, except
         '  the first which is the Product, in our case
         Dim i As Integer
         For i = 0 To ([source].Columns.Count - 1) - 1
            dest.Rows.Add(dest.NewRow())
         Next i
         
         ' now move the source columns to their position in the dest row/cell matrix
         '  starting down the destination rows, and across the columns
         Dim r As Integer
         For r = 0 To dest.Rows.Count - 1
            Dim c As Integer
            For c = 0 To dest.Columns.Count - 1
               If c = 0 Then
                  dest.Rows(r)(0) = [source].Columns((r + 1)).ColumnName ' the Product name
               Else
                  dest.Rows(r)(c) = [source].Rows((c - 1))((r + 1))
               End If
            Next c
         Next r
         dest.AcceptChanges()
         Return dest
      End Function 'PivotTable
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question