HeaderTemplate in GridView

Discussion in 'ASP .Net' started by =?Utf-8?B?SmliZXkgSmFjb2I=?=, Jan 24, 2007.

  1. Hi:

    I placed an <asp:Table> inside the HeaderTemplate of a TemplateField of a
    GridView. The contents of the <asp:Table just doesn't show up. Can someone
    please tell me why?

    Thanks,

    Jibey

    <asp:GridView Width="100%" CellPadding="0"
    CellSpacing="0" BorderStyle="none" ID="gvApps" runat="server"
    AllowPaging="false" PageSize="1"
    OnPageIndexChanging="gvApps_PageIndexChanging" AutoGenerateColumns="False"
    ShowHeader="false" OnRowDataBound="gvApps_RowDataBound">
    <PagerSettings Visible="True" />
    <AlternatingRowStyle BackColor="White" />
    <Columns>
    <asp:TemplateField
    ConvertEmptyStringToNull="False">
    <HeaderTemplate>
    <asp:Table ID="tblHeader" runat="server"
    CellPadding="0" CellSpacing="0" Width="100%">
    <asp:TableRow runat="server">
    <asp:TableCell Font-Bold="true"
    Text="Application Mnemonic and Name" runat="server" RowSpan="2" Width="25%"
    HorizontalAlign="center" VerticalAlign="middle" >
    </asp:TableCell>
    <asp:TableCell Font-Bold="true"
    Text="Application Business Value" runat="server" RowSpan="2" Width="20%"
    HorizontalAlign="center" VerticalAlign="middle" >
    </asp:TableCell>
    <asp:TableCell Font-Bold="true"
    Text="Level of Risk" runat="server" ColumnSpan="3" HorizontalAlign="center"
    Width="55%" >
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell Font-Bold="true"
    Text="Current" runat="server" HorizontalAlign="center" Width="19%" >
    </asp:TableCell>
    <asp:TableCell Font-Bold="true"
    Text="Next Year" runat="server" HorizontalAlign="center" Width="18%" >
    </asp:TableCell>
    <asp:TableCell Font-Bold="true"
    Text="In 2 Years" runat="server" HorizontalAlign="center" Width="18%" >
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table>
    </HeaderTemplate>
    <ItemTemplate>

    The rest of the code is omitted for clarity.

    Please help!
    =?Utf-8?B?SmliZXkgSmFjb2I=?=, Jan 24, 2007
    #1
    1. Advertising

  2. Actually, the problem is that the ShowHeader property of the gridview is set
    to false.

    But I have another problem now. My <asp:Table> in the <HeaderTemplate> of
    the gridview doesn't have a border and no matter what I do, it just doesn't
    work.

    Please help.

    Thanks.

    "Jibey Jacob" wrote:

    > Hi:
    >
    > I placed an <asp:Table> inside the HeaderTemplate of a TemplateField of a
    > GridView. The contents of the <asp:Table just doesn't show up. Can someone
    > please tell me why?
    >
    > Thanks,
    >
    > Jibey
    >
    > <asp:GridView Width="100%" CellPadding="0"
    > CellSpacing="0" BorderStyle="none" ID="gvApps" runat="server"
    > AllowPaging="false" PageSize="1"
    > OnPageIndexChanging="gvApps_PageIndexChanging" AutoGenerateColumns="False"
    > ShowHeader="false" OnRowDataBound="gvApps_RowDataBound">
    > <PagerSettings Visible="True" />
    > <AlternatingRowStyle BackColor="White" />
    > <Columns>
    > <asp:TemplateField
    > ConvertEmptyStringToNull="False">
    > <HeaderTemplate>
    > <asp:Table ID="tblHeader" runat="server"
    > CellPadding="0" CellSpacing="0" Width="100%">
    > <asp:TableRow runat="server">
    > <asp:TableCell Font-Bold="true"
    > Text="Application Mnemonic and Name" runat="server" RowSpan="2" Width="25%"
    > HorizontalAlign="center" VerticalAlign="middle" >
    > </asp:TableCell>
    > <asp:TableCell Font-Bold="true"
    > Text="Application Business Value" runat="server" RowSpan="2" Width="20%"
    > HorizontalAlign="center" VerticalAlign="middle" >
    > </asp:TableCell>
    > <asp:TableCell Font-Bold="true"
    > Text="Level of Risk" runat="server" ColumnSpan="3" HorizontalAlign="center"
    > Width="55%" >
    > </asp:TableCell>
    > </asp:TableRow>
    > <asp:TableRow runat="server">
    > <asp:TableCell Font-Bold="true"
    > Text="Current" runat="server" HorizontalAlign="center" Width="19%" >
    > </asp:TableCell>
    > <asp:TableCell Font-Bold="true"
    > Text="Next Year" runat="server" HorizontalAlign="center" Width="18%" >
    > </asp:TableCell>
    > <asp:TableCell Font-Bold="true"
    > Text="In 2 Years" runat="server" HorizontalAlign="center" Width="18%" >
    > </asp:TableCell>
    > </asp:TableRow>
    > </asp:Table>
    > </HeaderTemplate>
    > <ItemTemplate>
    >
    > The rest of the code is omitted for clarity.
    >
    > Please help!
    =?Utf-8?B?SmliZXkgSmFjb2I=?=, Jan 24, 2007
    #2
    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. SamIAm
    Replies:
    1
    Views:
    4,551
    Bipin Joshi [MVP]
    Jun 26, 2003
  2. Vijaya
    Replies:
    2
    Views:
    2,643
    Vijaya
    Nov 13, 2003
  3. =?Utf-8?B?Tkg=?=

    button in headertemplate of gridview

    =?Utf-8?B?Tkg=?=, Apr 7, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    11,445
    Aytaç ÖZAY
    Apr 7, 2006
  4. jm
    Replies:
    0
    Views:
    344
  5. Andy B

    accessing GridView headerTemplate

    Andy B, Aug 4, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    384
    Munna
    Aug 5, 2008
Loading...

Share This Page