DetailsView HeaderTemplate

D

David C

I have a DetailsView with Templates inside the Fields tag. I would like my
separate HeaderTemplate to span both columns of the DetailsView. is there
an easy way to do this? below is a sample HeaderTemplate for my page.
Thanks.

<asp:TemplateField>
<HeaderTemplate>
<br />
<asp:Label ID="Header1" runat="server" Text="1.
DESCRIPTION OF OPERATIONS AT THIS LOCATION:" Font-Bold="True"
Font-Size="Larger"></asp:Label>
<hr />
</HeaderTemplate>
</asp:TemplateField>

David
 
M

miher

David C said:
I have a DetailsView with Templates inside the Fields tag. I would like
my separate HeaderTemplate to span both columns of the DetailsView. is
there an easy way to do this? below is a sample HeaderTemplate for my
page. Thanks.

<asp:TemplateField>
<HeaderTemplate>
<br />
<asp:Label ID="Header1" runat="server" Text="1.
DESCRIPTION OF OPERATIONS AT THIS LOCATION:" Font-Bold="True"
Font-Size="Larger"></asp:Label>
<hr />
</HeaderTemplate>
</asp:TemplateField>

David
Hi,

Can You please post a more concrete example ?

-Zsolt
 
D

David C

Below is the whole DetailsView. The header templates I want to expand
accross both columns of the resulting html table that it generates. Thanks.

<asp:DetailsView ID="dvForeignTravel" runat="server" Width="95%"
DataKeyNames="PropertyID" DataSourceID="SqlForeignTravel"
ForeColor="Black" Font-Size="11pt" Font-Names="Arial"
BackColor="LightGoldenrodYellow"
BorderColor="Tan" BorderWidth="1px" AutoGenerateRows="False"
CellPadding="2" GridLines="Both" >
<Fields>
<asp:BoundField DataField="PropertyID" HeaderText="PropertyID"
InsertVisible="False" ReadOnly="True"
SortExpression="PropertyID" Visible="False" />
<asp:TemplateField>
<HeaderTemplate>
<br />
<asp:Label ID="Header1" runat="server" Font-Bold="True"
Font-Size="Small" ForeColor="Blue"
Text="Please provide a summary of foreign travel for
all employees traveling outside the U. S. with respect to the location
referenced above."></asp:Label>
</HeaderTemplate>
</asp:TemplateField>

<asp:TemplateField>
<HeaderTemplate>
<br />
<asp:Label ID="Header3" runat="server" Text="Foreign
Travel Summary" Font-Bold="True" Font-Size="Larger"></asp:Label>
<hr color="Black" />
</HeaderTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Average Number of Trips Abroad Per
Year Per Employee" SortExpression="AvgTrips">
<EditItemTemplate>
<asp:TextBox ID="txtAvgTrips" runat="server" Text='<%#
Bind("AvgTrips") %>' ></asp:TextBox>
</EditItemTemplate>

<ItemTemplate>
<asp:Label ID="lblAvgTrips" runat="server" Text='<%#
Bind("AvgTrips") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Number of Employees Traveling
Abroad" SortExpression="EmployeesTraveling">
<EditItemTemplate>
<asp:TextBox ID="txtEmployeesTraveling" runat="server"
Text='<%# Bind("EmployeesTraveling") %>' ></asp:TextBox>
</EditItemTemplate>

<ItemTemplate>
<asp:Label ID="lblEmployeesTraveling" runat="server"
Text='<%# Bind("EmployeesTraveling") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Average Duration of Trip (in
days)" SortExpression="AvgDuration">
<EditItemTemplate>
<asp:TextBox ID="txtAvgDuration" runat="server"
Text='<%# Bind("AvgDuration") %>' ></asp:TextBox>
</EditItemTemplate>

<ItemTemplate>
<asp:Label ID="lblAvgDuration" runat="server" Text='<%#
Bind("AvgDuration") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField>
<HeaderTemplate>
<br />
<asp:Label ID="Header4" runat="server" Text="Expatriate
Information" Font-Bold="True" Font-Size="Larger"></asp:Label>
<hr color="Black" />
</HeaderTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Total Number of Expatriates"
SortExpression="Expatriates">
<EditItemTemplate>
<asp:TextBox ID="txtExpatriates" runat="server"
Text='<%# Bind("Expatriates") %>' ></asp:TextBox>
</EditItemTemplate>

<ItemTemplate>
<asp:Label ID="lblExpatriates" runat="server" Text='<%#
Bind("Expatriates") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Average Payroll Per
Expatriate" SortExpression="AvgExpatriatePayroll">
<EditItemTemplate>
<asp:TextBox ID="txtAvgExpatriatePayroll"
runat="server" Text=' said:
></asp:TextBox>
</EditItemTemplate>

<ItemTemplate>
<asp:Label ID="lblAvgExpatriatePayroll" runat="server"
Text='<%# Bind("AvgExpatriatePayroll","{0:c}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField>
<HeaderTemplate>
<br />
<asp:Label ID="Header5" runat="server" Text="Defense
Base Acts (Applicable to U.S. Government Contacts Only)" Font-Bold="True"
Font-Size="Larger"></asp:Label>
<hr color="Black" />
</HeaderTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Is the Defense Base Act
applicable to any work performed abroad?" SortExpression="Expatriates">
<EditItemTemplate>
<asp:DropDownList ID="ddlDefenseAct" runat="server"
SelectedValue='<%# Bind("DefenseAct") %>'>
<asp:ListItem Text="" Value=""></asp:ListItem>
<asp:ListItem Text="yes"
Value="yes"></asp:ListItem>
<asp:ListItem Text="no"
Value="no"></asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>

<ItemTemplate>
<asp:Label ID="lblDefenseAct" runat="server" Text='<%#
Bind("DefenseAct") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Defense Base Contract # (if
applicable)" SortExpression="DefenseContractNo">
<EditItemTemplate>
<asp:TextBox ID="txtDefenseContractNo" runat="server"
Text='<%# Bind("DefenseContractNo") %>' ></asp:TextBox>
</EditItemTemplate>

<ItemTemplate>
<asp:Label ID="lblDefenseContractNo" runat="server"
Text='<%# Bind("DefenseContractNo") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Payroll/Contract if
applicable" SortExpression="PayrollContract">
<EditItemTemplate>
<asp:TextBox ID="PayrollContract" runat="server"
Text='<%# Bind("PayrollContract") %>' ></asp:TextBox>
</EditItemTemplate>

<ItemTemplate>
<asp:Label ID="lblPayrollContract" runat="server"
Text='<%# Bind("PayrollContract") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Last Updated"
SortExpression="LastUpdated">
<ItemTemplate>
<asp:Label ID="lblLastUpdated" runat="server"
Text='<%# Bind("LastUpdated") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />

</Fields>
<FooterStyle BackColor="Tan" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
HorizontalAlign="Center" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<EditRowStyle BackColor="#CCCCCC" ForeColor="Black" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:DetailsView>
 

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,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top