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

M

mortb

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
 
S

Sal

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
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
 
L

Leonardo Rodríguez

Of course you can.
This link can help you:

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


Regards,

--

Leonardo C. Rodríguez
Email at: (e-mail address removed)
Location : Bs.As., Argentina



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
 
M

mortb

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
Of course you can.
This link can help you:

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


Regards,

--

Leonardo C. Rodríguez
Email at: (e-mail address removed)
Location : Bs.As., Argentina



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
 
D

David Jessee

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>



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
 
M

mortb

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

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top