Professional Web Applications Themes

DataGrid (body only) contained in <span>...</span> tags - ASP.NET Data Grid Control

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 control within <span> tags (this enables us to use a scroll bar to look through the records in the datagrid, instead of using paging). My problem is this: How can I get the header for the DataGrid to be displayed outside the <span>? I do not know if this is possible with the ASP.NET built-in DataGrid control, but I would be most interested in learning possible solutions... the current code that I am using ...

  1. #1

    Default 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
    control within <span> tags (this enables us to use a scroll bar to
    look through the records in the datagrid, instead of using paging).

    My problem is this: How can I get the header for the DataGrid to be
    displayed outside the <span>? I do not know if this is possible with
    the ASP.NET built-in DataGrid control, but I would be most interested
    in learning possible solutions... the current code that I am using is
    posted below. It shows the DataGrid entirely wrapped in the <span>,
    meaning that the Header is not visible once you scroll down a little
    bit...

    CODE:
    <span runat="server" id="dgSpan">
    <asp:DataGrid ID="dgIssueListing" GridLines="Both" BorderWidth="2px"
    CssClass="regularText" AutoGenerateColumns="False" AllowSorting="True"
    AllowPaging="False" ShowHeader="True"
    ShowFooter="False"Runat="server">
    <Columns>
    <asp:ButtonColumn ButtonType="LinkButton" CommandName="Select"
    Visible="False"></asp:ButtonColumn>
    <asp:TemplateColumn HeaderText="ID" SortExpression="issueID">
    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center" Width="25px"></ItemStyle>
    <ItemTemplate>
    <asp:Label ID="lblIssueID" Width="25px" Text='<%#
    DataBinder.Eval(Container.DataItem, "issueID")%>' Runat="server"
    CssClass="regularText">
    </asp:Label>
    </ItemTemplate>
    </asp:TemplateColumn>
    <asp:BoundColumn HeaderText="Status" DataField="status"
    SortExpression="status" HeaderStyle-HorizontalAlign="Center"
    ItemStyle-HorizontalAlign="Center"
    ItemStyle-Width="45px"></asp:BoundColumn>
    <asp:BoundColumn HeaderText="Priority" DataField="priority"
    SortExpression="priority" HeaderStyle-HorizontalAlign="Center"
    ItemStyle-HorizontalAlign="Center"
    ItemStyle-Width="45px"></asp:BoundColumn>
    <asp:BoundColumn HeaderText="Task" DataField="taskDesc"
    SortExpression="taskDesc" ItemStyle-Width="120px"></asp:BoundColumn>
    <asp:BoundColumn HeaderText="Subject" DataField="issueSubj"
    SortExpression="issueSubj" ItemStyle-Width="275px"></asp:BoundColumn>
    </Columns>
    <HeaderStyle BackColor="Gray" ForeColor="White"
    Font-Bold="True"></HeaderStyle>
    </asp:DataGrid>
    </span>

    Many Thanks,
    -Dan Bishop
    Dan Bishop Guest

  2. #2

    Default Re: DataGrid (body only) contained in <span>...</span> tags

    you can create another datagrid before the <span> tag and display only the
    header there...
    you should clear (delete all rows) from your dataset before you bind to the
    header DataGrid...

    or also...
    you create a <DIV> tag before the <span> tag and move the header there with
    javascript...
    below is the code....
    =================================
    <script language="javascript>
    var dg = doent.getElementById("dgIssueListing");
    var dgTbl = dg.getElementsByTagName("table");
    dgTbl= dgTbl[0];

    var rowcopy = dgTbl.rows[0].cloneNode(true);
    DivHeaderTbl.rows[0].appendChild(rowcopy);

    dgTbl.rows[0].removeNode();
    DivHeaderTbl.moveRow(1,0);
    </script>
    =====================================

    ---------
    Kilic Beg


    "Dan Bishop" <d2bishopengmail.uwaterloo.ca> wrote in message
    news:398bf3d0.0406070452.389824e6posting.google.c om...
    > 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
    > control within <span> tags (this enables us to use a scroll bar to
    > look through the records in the datagrid, instead of using paging).
    >
    > My problem is this: How can I get the header for the DataGrid to be
    > displayed outside the <span>? I do not know if this is possible with
    > the ASP.NET built-in DataGrid control, but I would be most interested
    > in learning possible solutions... the current code that I am using is
    > posted below. It shows the DataGrid entirely wrapped in the <span>,
    > meaning that the Header is not visible once you scroll down a little
    > bit...
    >
    > CODE:
    > <span runat="server" id="dgSpan">
    > <asp:DataGrid ID="dgIssueListing" GridLines="Both" BorderWidth="2px"
    > CssClass="regularText" AutoGenerateColumns="False" AllowSorting="True"
    > AllowPaging="False" ShowHeader="True"
    > ShowFooter="False"Runat="server">
    > <Columns>
    > <asp:ButtonColumn ButtonType="LinkButton" CommandName="Select"
    > Visible="False"></asp:ButtonColumn>
    > <asp:TemplateColumn HeaderText="ID" SortExpression="issueID">
    > <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
    > <ItemStyle HorizontalAlign="Center" Width="25px"></ItemStyle>
    > <ItemTemplate>
    > <asp:Label ID="lblIssueID" Width="25px" Text='<%#
    > DataBinder.Eval(Container.DataItem, "issueID")%>' Runat="server"
    > CssClass="regularText">
    > </asp:Label>
    > </ItemTemplate>
    > </asp:TemplateColumn>
    > <asp:BoundColumn HeaderText="Status" DataField="status"
    > SortExpression="status" HeaderStyle-HorizontalAlign="Center"
    > ItemStyle-HorizontalAlign="Center"
    > ItemStyle-Width="45px"></asp:BoundColumn>
    > <asp:BoundColumn HeaderText="Priority" DataField="priority"
    > SortExpression="priority" HeaderStyle-HorizontalAlign="Center"
    > ItemStyle-HorizontalAlign="Center"
    > ItemStyle-Width="45px"></asp:BoundColumn>
    > <asp:BoundColumn HeaderText="Task" DataField="taskDesc"
    > SortExpression="taskDesc" ItemStyle-Width="120px"></asp:BoundColumn>
    > <asp:BoundColumn HeaderText="Subject" DataField="issueSubj"
    > SortExpression="issueSubj" ItemStyle-Width="275px"></asp:BoundColumn>
    > </Columns>
    > <HeaderStyle BackColor="Gray" ForeColor="White"
    > Font-Bold="True"></HeaderStyle>
    > </asp:DataGrid>
    > </span>
    >
    > Many Thanks,
    > -Dan Bishop

    Kilic Beg Guest

  3. #3

    Default Re: DataGrid (body only) contained in <span>...</span> tags

    also check this article out..
    [url]http://www.dnzone.com/ShowDetail.asp?NewsId=564[/url]

    "Dan Bishop" <d2bishopengmail.uwaterloo.ca> wrote in message
    news:398bf3d0.0406070452.389824e6posting.google.c om...
    > 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
    > control within <span> tags (this enables us to use a scroll bar to
    > look through the records in the datagrid, instead of using paging).
    >
    > My problem is this: How can I get the header for the DataGrid to be
    > displayed outside the <span>? I do not know if this is possible with
    > the ASP.NET built-in DataGrid control, but I would be most interested
    > in learning possible solutions... the current code that I am using is
    > posted below. It shows the DataGrid entirely wrapped in the <span>,
    > meaning that the Header is not visible once you scroll down a little
    > bit...
    >
    > CODE:
    > <span runat="server" id="dgSpan">
    > <asp:DataGrid ID="dgIssueListing" GridLines="Both" BorderWidth="2px"
    > CssClass="regularText" AutoGenerateColumns="False" AllowSorting="True"
    > AllowPaging="False" ShowHeader="True"
    > ShowFooter="False"Runat="server">
    > <Columns>
    > <asp:ButtonColumn ButtonType="LinkButton" CommandName="Select"
    > Visible="False"></asp:ButtonColumn>
    > <asp:TemplateColumn HeaderText="ID" SortExpression="issueID">
    > <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
    > <ItemStyle HorizontalAlign="Center" Width="25px"></ItemStyle>
    > <ItemTemplate>
    > <asp:Label ID="lblIssueID" Width="25px" Text='<%#
    > DataBinder.Eval(Container.DataItem, "issueID")%>' Runat="server"
    > CssClass="regularText">
    > </asp:Label>
    > </ItemTemplate>
    > </asp:TemplateColumn>
    > <asp:BoundColumn HeaderText="Status" DataField="status"
    > SortExpression="status" HeaderStyle-HorizontalAlign="Center"
    > ItemStyle-HorizontalAlign="Center"
    > ItemStyle-Width="45px"></asp:BoundColumn>
    > <asp:BoundColumn HeaderText="Priority" DataField="priority"
    > SortExpression="priority" HeaderStyle-HorizontalAlign="Center"
    > ItemStyle-HorizontalAlign="Center"
    > ItemStyle-Width="45px"></asp:BoundColumn>
    > <asp:BoundColumn HeaderText="Task" DataField="taskDesc"
    > SortExpression="taskDesc" ItemStyle-Width="120px"></asp:BoundColumn>
    > <asp:BoundColumn HeaderText="Subject" DataField="issueSubj"
    > SortExpression="issueSubj" ItemStyle-Width="275px"></asp:BoundColumn>
    > </Columns>
    > <HeaderStyle BackColor="Gray" ForeColor="White"
    > Font-Bold="True"></HeaderStyle>
    > </asp:DataGrid>
    > </span>
    >
    > Many Thanks,
    > -Dan Bishop

    Kilic Beg Guest

Similar Threads

  1. Row Span in a grid?
    By et in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: March 6th, 05:47 PM
  2. <span>'s
    By C in forum ASP
    Replies: 1
    Last Post: October 25th, 12:31 PM
  3. <SPAN> Tag
    By ccnk in forum Macromedia Fireworks
    Replies: 2
    Last Post: October 12th, 10:38 AM
  4. DIV vs SPAN
    By Bill Ray in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 22nd, 04:22 AM
  5. <span> attributes
    By Ante Perkovic in forum ASP.NET General
    Replies: 2
    Last Post: July 4th, 11:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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