Is it possible to create a custom header/footer - not with column names but with html

Discussion in 'ASP .Net Datagrid Control' started by mortb, May 12, 2004.

  1. mortb

    mortb Guest

    I want to know if it is possible to create my own header and footer which contains
    arbitrary text/html items in a datagrid .

    Look at the included picture for example.
    Another example:

    +----------------------------+
    | Header text |
    +---------+---------+--------+
    | Item1.1 | Item1.2 | Item1.3|
    +---------+---------+--------+
    | Item2.1 | Item2.2 | Item2.3|
    +---------+---------+--------+
    | <input field><button> |
    +---------+---------+--------+

    How do I do this?
    Any help would be deeply appreciated!

    chers,
    mortb
     
    mortb, May 12, 2004
    #1
    1. Advertising

  2. mortb

    Sal Guest

    Mortb,
    See my post "ItemCommand not firing w/ a control in ItemTemplate column". There I indicate a problem but I include code that does what ur looking to do. That code creates and adds the custom header row to the datagrid.
    It works but I'm not sure if that is the best way to do it. As I say in the post I'm dealing with a problem with that and an itemtemplate in the grid. It'll get you started though.
    HTH,
    Sal
    "mortb" <> wrote in message news:%...
    I want to know if it is possible to create my own header and footer which contains
    arbitrary text/html items in a datagrid .

    Look at the included picture for example.
    Another example:

    +----------------------------+
    | Header text |
    +---------+---------+--------+
    | Item1.1 | Item1.2 | Item1.3|
    +---------+---------+--------+
    | Item2.1 | Item2.2 | Item2.3|
    +---------+---------+--------+
    | <input field><button> |
    +---------+---------+--------+

    How do I do this?
    Any help would be deeply appreciated!

    chers,
    mortb
     
    Sal, May 12, 2004
    #2
    1. Advertising

  3. Of course you can.
    This link can help you:

    http://msdn.microsoft.com/library/d...kaddingtemplatecolumntodatagridwebcontrol.asp


    Regards,

    --

    Leonardo C. Rodríguez
    Email at:
    Location : Bs.As., Argentina



    "mortb" <> wrote in message news:%...
    I want to know if it is possible to create my own header and footer which contains
    arbitrary text/html items in a datagrid .

    Look at the included picture for example.
    Another example:

    +----------------------------+
    | Header text |
    +---------+---------+--------+
    | Item1.1 | Item1.2 | Item1.3|
    +---------+---------+--------+
    | Item2.1 | Item2.2 | Item2.3|
    +---------+---------+--------+
    | <input field><button> |
    +---------+---------+--------+

    How do I do this?
    Any help would be deeply appreciated!

    chers,
    mortb
     
    Leonardo Rodríguez, May 12, 2004
    #3
  4. mortb

    mortb Guest

    Thank you for your help,
    I would like to know though if it is possible to make the header span several columns. (Like colspan in a regular table).

    cheers,
    mortb
    "Leonardo Rodríguez" <> wrote in message news:...
    Of course you can.
    This link can help you:

    http://msdn.microsoft.com/library/d...kaddingtemplatecolumntodatagridwebcontrol.asp


    Regards,

    --

    Leonardo C. Rodríguez
    Email at:
    Location : Bs.As., Argentina



    "mortb" <> wrote in message news:%...
    I want to know if it is possible to create my own header and footer which contains
    arbitrary text/html items in a datagrid .

    Look at the included picture for example.
    Another example:

    +----------------------------+
    | Header text |
    +---------+---------+--------+
    | Item1.1 | Item1.2 | Item1.3|
    +---------+---------+--------+
    | Item2.1 | Item2.2 | Item2.3|
    +---------+---------+--------+
    | <input field><button> |
    +---------+---------+--------+

    How do I do this?
    Any help would be deeply appreciated!

    chers,
    mortb
     
    mortb, May 13, 2004
    #4
  5. mortb

    David Jessee Guest

    I don't know if its directly possible, but I can tell you how I do it. I turn off the header and then place the grid inside of a table.

    <table cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td>The Pseudo-Header Text</td>
    </tr>
    <tr>
    <td>
    <asp:datagrid .........>
    </asp:datagrid>
    </td>
    </tr>
    </table>



    "mortb" <> wrote in message news:%...
    I want to know if it is possible to create my own header and footer which contains
    arbitrary text/html items in a datagrid .

    Look at the included picture for example.
    Another example:

    +----------------------------+
    | Header text |
    +---------+---------+--------+
    | Item1.1 | Item1.2 | Item1.3|
    +---------+---------+--------+
    | Item2.1 | Item2.2 | Item2.3|
    +---------+---------+--------+
    | <input field><button> |
    +---------+---------+--------+

    How do I do this?
    Any help would be deeply appreciated!

    chers,
    mortb
     
    David Jessee, May 13, 2004
    #5
  6. mortb

    mortb Guest

    I wanted an exact apperance where the header was as big as the datagrid an aligned pixel to pixel.

    What I finally did was:

    <table>
    <tr>
    <td>
    <table cellpadding="0" cellspacing="0" border="0" witdh="100%">
    <tr>
    <td>Header</td>
    </tr>
    </table>
    <asp:datagrid id="myGrid" runat="server" witdh="100%" ShowHeader="False" />
    <table cellpadding="0" cellspacing="0" border="0" witdh="100%">
    <tr>
    <td><asp:textbox id="myTxt" runat="server" /><asp:button id="myBtn" runat="server" /></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>

    I could have solved this programatically by adding my custom header through code but I believe that design and code should be a separate things.
    I guess I could've found the behavior I wanted in a third party grid, but I think it's hard to know what grid to get.
    It would have been easier if the colspan attribute was implemented from the start in microsoft's grid.

    I guess I'll have to write my own grid some day.

    cheers,
    mortb

    "David Jessee" <> wrote in message news:%23%...
    I don't know if its directly possible, but I can tell you how I do it. I turn off the header and then place the grid inside of a table.

    <table cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td>The Pseudo-Header Text</td>
    </tr>
    <tr>
    <td>
    <asp:datagrid .........>
    </asp:datagrid>
    </td>
    </tr>
    </table>
     
    mortb, May 24, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Crowley
    Replies:
    2
    Views:
    481
    =?Utf-8?B?Sm9obiBDcm93bGV5?=
    Feb 6, 2004
  2. Dav999
    Replies:
    4
    Views:
    723
    Dav999
    Oct 2, 2004
  3. Elena
    Replies:
    0
    Views:
    874
    Elena
    May 3, 2007
  4. hansiman

    Image in header column (not replacing column header text)

    hansiman, Feb 5, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    310
    hansiman
    Feb 7, 2004
  5. Henrik
    Replies:
    1
    Views:
    428
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
Loading...

Share This Page