How can I make a header column span?

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default How can I make a header column span?

    I would like my header column span multiple columns, for example:

    Date
    Ready Open Close
    ---------------------------
    08/06 10 am 5pm

    How can I do that?

    Thanks,

    -Stan


    Stan Guest

  2. Similar Questions and Discussions

    1. Two column header rows possible?
      We are currently creating output displaying 'Total' and 'Avg' information. Is it possible to add a row above, spanning multiple columns similar to...
    2. DataGrid (body only) contained in <span>...</span> tags
      Hi, I have a DataGrid control that displays many records. As such, I have been given a requirement to contain only the body of my DataGrid...
    3. Column Header
      I have a web form with a datagrid. The datagrid has 5 columns. In design mode each column has header text. I defined the header text, data source,...
    4. Image in header column (not replacing column header text)
      I have a sortable (asc/desc) datagrid and would like to add a small arrow icon (down/up) next to the column header text to improve the UI. Is this...
    5. Button in column header
      I want to put a button in a column header. How do I handle the event when the button is clicked?
  3. #2

    Default Re: How can I make a header column span?

    Are we talking about a DataGrid, or another server control, maybe , or a
    basic HTML table, (or what)?


    David Wier
    [url]http://aspnet101.com[/url]
    [url]http://aspexpress.com[/url]


    "Stan" <nospam@yahoo.com> wrote in message
    news:eyJ8U8CXDHA.3924@tk2msftngp13.phx.gbl...
    > I would like my header column span multiple columns, for example:
    >
    > Date
    > Ready Open Close
    > ---------------------------
    > 08/06 10 am 5pm
    >
    > How can I do that?
    >
    > Thanks,
    >
    > -Stan
    >
    >

    ElmoWatson Guest

  4. #3

    Default Re: How can I make a header column span?

    DataGrid

    "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
    news:OecuHADXDHA.2464@TK2MSFTNGP09.phx.gbl...
    > Are we talking about a DataGrid, or another server control, maybe , or a
    > basic HTML table, (or what)?
    >
    >
    > David Wier
    > [url]http://aspnet101.com[/url]
    > [url]http://aspexpress.com[/url]
    >
    >
    > "Stan" <nospam@yahoo.com> wrote in message
    > news:eyJ8U8CXDHA.3924@tk2msftngp13.phx.gbl...
    > > I would like my header column span multiple columns, for example:
    > >
    > > Date
    > > Ready Open Close
    > > ---------------------------
    > > 08/06 10 am 5pm
    > >
    > > How can I do that?
    > >
    > > Thanks,
    > >
    > > -Stan
    > >
    > >
    >
    >

    Stan Guest

  5. #4

    Default RE: How can I make a header column span?

    Hello,

    How about nesting a datagrid in a template column of another datagrid?

    HTH,

    --
    Parker Zhang
    Microsoft Developer Support

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Parker Zhang [MSFT] Guest

  6. #5

    Default Re: How can I make a header column span?

    Hmm...

    Not sure I understood that...

    The problem is that neither <asp:boundcolumn> no <asp:templatecolumn>
    provide a way
    of splitting a header colum:

    Store ! Time
    ---- ----------------------------
    ! Open ! Close
    ---------------------------------
    ABC 10 9
    XYZ 11 5

    Seems like it is impossible to do in datagrid...


    "Parker Zhang [MSFT]" <parzhang@online.microsoft.com> wrote in message
    news:kiOqeMWXDHA.2544@cpmsftngxa06.phx.gbl...
    > Hello,
    >
    > How about nesting a datagrid in a template column of another datagrid?
    >
    > HTH,
    >
    > --
    > Parker Zhang
    > Microsoft Developer Support
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    rights.
    >

    Stan Guest

  7. #6

    Default Re: How can I make a header column span?

    Hello,

    Please have a look at the following code. It will clarify my post. I know
    it is not the best anwser. but at least it works.

    <asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
    <Columns>
    <asp:TemplateColumn HeaderText="Store">
    <ItemTemplate>
    <asp:DataGrid id=DataGrid2 runat="server" DataSource="<%#
    MyDataSet1 %>" DataMember="YourTableName" AutoGenerateColumns="False">
    <Columns>
    <asp:BoundColumn DataField="Store"
    SortExpression="Store"></asp:BoundColumn>
    </Columns>
    </asp:DataGrid>
    </ItemTemplate>
    </asp:TemplateColumn>

    <asp:TemplateColumn HeaderText="Time">
    <ItemTemplate>
    <asp:DataGrid id=DataGrid3 runat="server" DataSource="<%#
    MyDataSet1 %>" DataMember="YourTableName" AutoGenerateColumns="False">
    <Columns>
    <asp:BoundColumn DataField="Open"
    SortExpression="Open" HeaderText="CompanyName"></asp:BoundColumn>
    <asp:BoundColumn DataField="Close"
    SortExpression="Close" HeaderText="ContactName"></asp:BoundColumn>
    </Columns>
    </asp:DataGrid>
    </ItemTemplate>
    </asp:TemplateColumn>
    </Columns>
    </asp:DataGrid>


    ------------------------------------------------------

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    SqlDataAdapter1.Fill(MyDataSet1)
    Dim values As ArrayList = New ArrayList()
    values.Add(0)
    DataGrid1.DataSource = values
    DataGrid1.DataBind()
    End Sub

    Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.DataGridItemEventArgs) Handles
    DataGrid1.ItemDataBound
    Dim dg As DataGrid
    dg = e.Item.FindControl("DataGrid2")
    If Not dg Is Nothing Then
    dg.DataBind()
    End If
    dg = e.Item.FindControl("DataGrid3")
    If Not dg Is Nothing Then
    dg.DataBind()
    End If
    End Sub




    --
    Parker Zhang
    Microsoft Developer Support

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Parker Zhang [MSFT] Guest

Posting Permissions

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

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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139